indexing - Configure better index choices for MySQL -


i have mysql table ~17m rows end doing lot of aggregation queries.

for example lets have index_on_b, index_on_c, compound_index_on_a_b, compound_index_on_a_c

i try , run query explain

explain select sum(revenue) table = some_value , b = other_value 

and find selected index index_on_b, when use query hint

select sum(revenue) table use index(compound_index_on_a_b) 

the query runs way way faster. there can in mysql config make mysql choose compound indexes first?

there 2 possible routes can take:

a) index resolution process when according optimizer things equal based on order indexes created in. drop index_b , recreate , check if optimizer in scenario thought same.

or

b) use optimizer_search_depth (see https://mariadb.com/blog/setting-optimizer-search-depth-mysql). altering parameter determine how effort optimizer allowed spend on query plan, , might come better solution of using combined index.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -