Good time. The database has two composite indexes for selecting ads: all ads and VIP (premium).
Questions:
Do I need to duplicate columns in the second index if they already exist in the first index?
Columns for the index wrote everything that is in the query (after the where and order by). Is this right or can you just choose a couple?
The order of the columns was based on counting
count(*)for each column and choosing an average value over it. Is it right?Did I understand correctly that if the sample is used for one field from the database, and our index is composite, then, in this case, the index is not taken into account?
In the sample, if the operator
||then the index is not taken into account. Why- Should id_advert be added to indexes?
thank