MySQL Forums :: Performance :: Query optimize on large database


Advanced Search

Re: Query optimize on large database
Posted by: Pavel Volkov ()
Date: July 16, 2016 12:36PM

Here's table structure:

CREATE TABLE `data` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`owner_id` int(11) NOT NULL DEFAULT '0',
`artist` int(11) NOT NULL DEFAULT '0',
`title` int(11) NOT NULL DEFAULT '0',

PRIMARY KEY (`id`),
KEY `FK_data_Title_id` (`title`),
KEY `owner_id` (`owner_id`),
KEY `song` (`artist`,`title`),
KEY `FK_data_Artist_id` (`artist`),

CONSTRAINT `FK_data_Artists_id` FOREIGN KEY (`artist`) REFERENCES `Artists` (`id`),
CONSTRAINT `FK_data_Title_id` FOREIGN KEY (`title`) REFERENCES `Title` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=328181938 DEFAULT CHARSET=utf8 AVG_ROW_LENGTH=37


QUERY EXPLAIN :


SIMPLE d1 ref FK_data_Title_id,owner_id, song,FK_data_Artist_id owner_id 4 const 328 Using temporary; Using filesort

SIMPLE d2 ref FK_data_Title_id,song, FK_data_Artist_id song 8 joystor1_1.d1.artist,joystor1_1.d1.title 4

Options: ReplyQuote


Subject Views Written By Posted
Query optimize on large database 542 Pavel Volkov 07/13/2016 01:40AM
Re: Query optimize on large database 319 Rick James 07/15/2016 05:12PM
Re: Query optimize on large database 322 Pavel Volkov 07/16/2016 04:15AM
Re: Query optimize on large database 309 Peter Brawley 07/16/2016 12:09PM
Re: Query optimize on large database 298 Pavel Volkov 07/16/2016 12:36PM
Re: Query optimize on large database 290 Rick James 07/16/2016 02:46PM
Re: Query optimize on large database 303 Peter Brawley 07/17/2016 11:22AM
Re: Query optimize on large database 291 Pavel Volkov 07/18/2016 04:28AM
Re: Query optimize on large database 276 Peter Brawley 07/18/2016 08:40AM
Re: Query optimize on large database 298 james wang 07/20/2016 04:46AM
Re: Query optimize on large database 279 Pavel Volkov 07/20/2016 08:06AM
Re: Query optimize on large database 293 Rick James 07/20/2016 09:29AM
Re: Query optimize on large database 290 james wang 07/21/2016 04:35AM


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.