Re: please explain why this query isn't optimized

2004-09-07 Thread Egor Egorov
Oops, haven't noticed that these are InnoDB tables. The behavior of optimization and even explain are much different for InnoDB tables. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___

Re: please explain why this query isn't optimized

2004-09-07 Thread Egor Egorov
David T-G <[EMAIL PROTECTED]> wrote: > % Well, actually, there are 2.878 Meg rows, or 2878k. > > FYI, you're both right. Americans write numbers as x,xxx,xxx.xx while > Europeans typically write them as x.xxx.xxx,xx (dot as thousands > separator and comma as decimal separator). But programmers

Re: please explain why this query isn't optimized

2004-09-06 Thread David T-G
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bill, et al -- ...and then Bill Easton said... % % Well, actually, there are 2.878 Meg rows, or 2878k. FYI, you're both right. Americans write numbers as x,xxx,xxx.xx while Europeans typically write them as x.xxx.xxx,xx (dot as thousands separator

Re: please explain why this query isn't optimized

2004-09-06 Thread Bill Easton
ed | 4 | NULL | 52802 | Using where; Using index | ++---+---+-+-+--+--- +--+ 1 row in set (0.00 sec) == original message follows == From: Egor Egorov <[EMAIL PROTECTED]> Date: Mon, 06 Sep 2004 13:

Re: please explain why this query isn't optimized

2004-09-06 Thread Egor Egorov
Dave Dyer <[EMAIL PROTECTED]> wrote: > Before I post it as a bug, perhaps someone can explain why > this query is not optimized to use the index (it has to examine all 287k rows). > > mysql> explain SELECT MAX(changed) FROM archived_stats where changed>0; > | table | type | possible_key

RE: please explain why this query isn't optimized

2004-09-04 Thread Donny Simonton
n Nelson > Cc: Donny Simonton; [EMAIL PROTECTED] > Subject: Re: please explain why this query isn't optimized > > > > > >> Getting the same answer, from a simpler query, in infinitely > >> less time, just seems wrong to me. > > > >Ma

Re: please explain why this query isn't optimized

2004-09-04 Thread Dave Dyer
> >> Getting the same answer, from a simpler query, in infinitely >> less time, just seems wrong to me. > >Makes perfect sense. Simpler queries *are* easier to optimize, you >know :) Makes perfect sense. Thanks, I think the relevant points have been covered. -- MySQL General Mailing List Fo

Re: please explain why this query isn't optimized

2004-09-03 Thread Dan Nelson
In the last episode (Sep 03), Dave Dyer said: > At 05:39 PM 9/3/2004, Donny Simonton wrote: > >It would help if you would say how many entries do you have for > >changed =0 and how many are greater than 0. > > > >Since changed is a timestamp you should never get an entry of 0. So > >the query of c

Fwd: please explain why this query isn't optimized

2004-09-03 Thread Eric Bergen
MySQL is using the index in both of those. The first query where changed < 7890; should be very fast since explain says it only has to find one row. The second query, after mysql does a range scan on the index has to still examine 11551351 rows to find a max value. The last query SELECT MAX(ch

RE: please explain why this query isn't optimized

2004-09-03 Thread Dave Dyer
At 05:39 PM 9/3/2004, Donny Simonton wrote: >It would help if you would say how many entries do you have for changed =0 >and how many are greater than 0. > >Since changed is a timestamp you should never get an entry of 0. So the >query of changed>0 will always do a full table scan. This is defini

Re: please explain why this query isn't optimized

2004-09-03 Thread Eric Bergen
> > > -Original Message- > > From: Dave Dyer [mailto:[EMAIL PROTECTED] > > Sent: Friday, September 03, 2004 7:04 PM > > To: [EMAIL PROTECTED] > > Subject: please explain why this query isn't optimized > > > > > > Before I post it a

RE: please explain why this query isn't optimized

2004-09-03 Thread Donny Simonton
essage- > From: Dave Dyer [mailto:[EMAIL PROTECTED] > Sent: Friday, September 03, 2004 7:04 PM > To: [EMAIL PROTECTED] > Subject: please explain why this query isn't optimized > > > Before I post it as a bug, perhaps someone can explain why > this query is not op

please explain why this query isn't optimized

2004-09-03 Thread Dave Dyer
Before I post it as a bug, perhaps someone can explain why this query is not optimized to use the index (it has to examine all 287k rows). mysql> explain SELECT MAX(changed) FROM archived_stats where changed>0; ++---+---+-+-+--+-+---