Subject | Re: [firebird-support] Re: Natural plan on indexed column |
---|---|
Author | Matthias Hanft |
Post date | 2006-03-27T12:26:16Z |
Svein Erling Tysvær wrote:
50,000 rows, it goes like this:
select min(datetime) /* using index */ -> 32 ms
select min(datetime), max(datetime) /* no index */ -> 109 ms
select count(*) /* no index */ -> sometimes 109 ms, sometimes 78 ms
select count(*) where id>0 /* pk index */ -> 94 ms
I guess 50,000 rows are still too few to get some significant
timing measure results. Will try further... (maybe inserting
1 million rows tonight until tomorrow morning :-)
Matthias
>>select min(datetime) --->>> uses ascending indexHad not yet the time to insert 1 million rows :-) But with some
>>select max(datetime) --->>> uses descending index
>>select min(datetime), max(datetime) --->>> uses natural?!?!?!
>>
>>I cannot believe that it is faster to read all rows than just
>>using two indexes, one after another?!
>
> I agree with you and am surprised about your findings. Is it the same
> if the table contains 1 million rows with pretty unique datetime values?
50,000 rows, it goes like this:
select min(datetime) /* using index */ -> 32 ms
select min(datetime), max(datetime) /* no index */ -> 109 ms
select count(*) /* no index */ -> sometimes 109 ms, sometimes 78 ms
select count(*) where id>0 /* pk index */ -> 94 ms
I guess 50,000 rows are still too few to get some significant
timing measure results. Will try further... (maybe inserting
1 million rows tonight until tomorrow morning :-)
Matthias