MySQL Forums
Forum List  »  Optimizer & Parser

Re: Help with query/tables optimization
Posted by: Oleg Ivanov
Date: April 16, 2012 12:04PM

I went one step further.

7. I dropped PRIMARY key from artificial id and:
ALTER TABLE `user_profiles` DROP PRIMARY KEY , ADD PRIMARY KEY ( `original_user_id` , `lang` )
ALTER TABLE `user_profiles` ADD UNIQUE `id` ( `id` )
ALTER TABLE `user_profiles` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT


Query took 0.0018 sec
Query took 0.0025 sec
Query took 0.0014 sec
Query took 0.0012 sec

So, from step 1 to step 7 I got this query run:

1.4779 sec -> 0.0012 sec :))

PS. Made the same changes in production. Result got from 4 seconds to:

Query took 0.0022 sec
Query took 0.0023 sec



Edited 3 time(s). Last edit at 04/16/2012 12:33PM by Oleg Ivanov.

Options: ReplyQuote


Subject
Views
Written By
Posted
2310
April 14, 2012 05:20AM
Re: Help with query/tables optimization
1803
April 16, 2012 12:04PM


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.