Answer the question
In order to leave comments, you need to log in
Do I understand correctly how the index will work?
For example, there is a table and fields in it:
entityId, name, country, value
primaryKey made a composite: entityId, name, country
do I understand correctly that if I make a select on these three fields in the table in one query, then in order to correctly work out index, you need to do WHERE first by entityId, the second WHERE is name, and the third where should be country. If you change the order, then the index simply will not work
. Do I understand correctly?
Answer the question
In order to leave comments, you need to log in
no. the main thing is that in where there were either the first field, or the first two fields, or all 3 fields. in what order you write them in the query - it doesn't matter.
those. where country = ??
will not use the index at all, but where country = ?? and entityId = ??
will only use the first part of the composite index (by entityId).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question