MySQL Forums
Forum List  »  NDB clusters

Re: Struggling to Optimize The Query
Posted by: Rick James
Date: July 29, 2016 06:07PM

(The NDB forum might be a better place.)

How many different values are possible for `mapping*key`? It seems like it might be better to use a `SET` datatype instead of the 5 varchar columns. Then all of this:

and ((`mcmk`.`mapping1_key` = 'API_KEY')
or (`mcmk`.`mapping2_key` = 'API_KEY')
or (`mcmk`.`mapping3_key` = 'API_KEY')
or (`mcmk`.`mapping4_key` = 'API_KEY')
or (`mcmk`.`mapping5_key` = 'API_KEY')
)
and ((`mcmk`.`mapping1_key` = 'API_METHOD')
or (`mcmk`.`mapping2_key` = 'API_METHOD')
or (`mcmk`.`mapping3_key` = 'API_METHOD')
or (`mcmk`.`mapping4_key` = 'API_METHOD')
or (`mcmk`.`mapping5_key` = 'API_METHOD'))

would turn into

AND ( mapping_keys & ... = ... )

Where the ... is the number representing (API_KEY | METHOD).

Or perhaps the 5 columns should be turned into up to 5 rows in another table.

Options: ReplyQuote


Subject
Views
Written By
Posted
1587
July 27, 2016 09:05AM
Re: Struggling to Optimize The Query
727
July 29, 2016 06:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.