Re: Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread mos
At 11:55 AM 10/15/2006, you wrote: On 10/15/06, Freebat Wangh <[EMAIL PROTECTED]> wrote: mysql> explain select lw.id, lw.sender as guest_id from gossip lw where lw.owner = 21821 order by lw.id desc limit 18540, 20\G; *** 1. row *** id:

Re: Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread Shen139
On 10/15/06, Freebat Wangh <[EMAIL PROTECTED]> wrote: mysql> explain select lw.id, lw.sender as guest_id from gossip lw where lw.owner = 21821 order by lw.id desc limit 18540, 20\G; *** 1. row *** id: 1 select_type: SIMPLE t

Re: Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread Shen139
On 10/15/06, freebat <[EMAIL PROTECTED]> wrote: This approach will make the query filesort. why? You use the index owner_id to filter the rows and the primary key index to perform the sort! or not? test it with explain: explain select lw.id , lw.sender as guest_id from gossip lw where lw

Re: Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread freebat
This approach will make the query filesort. Shen139 wrote: I don't understand why you are using an index like `owner_id` composed by `owner` and `id`! I think that you should change it removing `id` from the fields list: ... PRIMARY KEY (`id`), KEY `owner_id` (`owner`) ... On 10/15/06

Re: Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread Shen139
I don't understand why you are using an index like `owner_id` composed by `owner` and `id`! I think that you should change it removing `id` from the fields list: ... PRIMARY KEY (`id`), KEY `owner_id` (`owner`) ... On 10/15/06, freebat <[EMAIL PROTECTED]> wrote: this is the table: CREATE TA

Why 30,000,000 rows simple table index select so slow?

2006-10-15 Thread freebat
this is the table: CREATE TABLE `gossip` ( `id` bigint(20) unsigned NOT NULL auto_increment, `owner` int(11) NOT NULL, `sender` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `owner_id` (`owner`,`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin table status: mysql> show table st