Re: [PERFORM] Seq scan vs. Index scan with different query

2004-07-05 Thread Andrew McMillan
On Mon, 2004-07-05 at 15:46 +0200, [EMAIL PROTECTED] wrote: > On Mon, Jul 05, 2004 at 11:44:13PM +1200, Andrew McMillan wrote: > > > > DateTimeIndex was created on both columns (Date/Time): > > > CREATE INDEX "DateTimeIndex" ON "tablex" USING btree ("Date", "Time"); > > PostgreSQL is always going

Re: [PERFORM] Seq scan vs. Index scan with different query conditions

2004-07-05 Thread eleven
On Mon, Jul 05, 2004 at 11:44:13PM +1200, Andrew McMillan wrote: > > DateTimeIndex was created on both columns (Date/Time): > > CREATE INDEX "DateTimeIndex" ON "tablex" USING btree ("Date", "Time"); > PostgreSQL is always going to switch at some point, where the number of > rows that have to be re

Re: [PERFORM] Seq scan vs. Index scan with different query

2004-07-05 Thread Andrew McMillan
On Mon, 2004-07-05 at 12:15 +0200, [EMAIL PROTECTED] wrote: > Hello, > > Can anybody suggest any hint on this: > > temp=> EXPLAIN SELECT DISTINCT "number" FROM "tablex" WHERE "Date" BETWEEN > '2004-06-28'::date AND '2004-07-04'::date AND "Time" BETWEEN '00:00:00'::time AND > '18:01:00'::time; >

Re: [PERFORM] Seq scan vs. Index scan with different query conditions

2004-07-05 Thread Richard Huxton
[EMAIL PROTECTED] wrote: -> Index Scan using "DateTimeIndex" on "tablex" (cost=0.00..298272.66 rows=89903 width=8) -> Seq Scan on "tablex" (cost=0.00..307137.34 rows=97900 width=8) Basically, the difference is in upper "Time" value (as you can see, it's 18:01:00 in the first query and 19:01:0

[PERFORM] Seq scan vs. Index scan with different query conditions

2004-07-05 Thread eleven
Hello, Can anybody suggest any hint on this: temp=> EXPLAIN SELECT DISTINCT "number" FROM "tablex" WHERE "Date" BETWEEN '2004-06-28'::date AND '2004-07-04'::date AND "Time" BETWEEN '00:00:00'::time AND '18:01:00'::time; Unique (cost=305669.92..306119.43 rows=89 width=8) -> Sort (cos