Re: [PERFORM] Timestamp-based indexing

2004-08-16 Thread Tom Lane
Josh Berkus [EMAIL PROTECTED] writes: monitor=# explain analyze select * from eventtable where timestamp CURRENT_TIMESTAMP - INTERVAL '10 minutes'; Hmmm. What verison of PostgreSQL are you running? I seem to remember an issue in one version with selecting comparisons against now(). I'm

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Kevin Barnard
Harmon S. Nine wrote: monitor=# explain analyze select * from eventtable where timestamp CURRENT_TIMESTAMP - INTERVAL '10 minutes'; QUERY PLAN Try SELECT * FROM eventtable where timestamp BETWEEN (CURRENT_TIMESTAMP - INTERVAL '10

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Matthew T. O'Connor
VACUUM FULL ANALYZE every 3 hours seems a little severe. You will probably be be served just as well by VACUUM ANALYZE. But you probably don't need the VACUUM part most of the time. You might try doing an ANALYZE on the specific tables you are having issues with. Since ANALYZE should be

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Stephan Szabo
On Mon, 26 Jul 2004, Harmon S. Nine wrote: However, we can't get the planner to do an timestamp-based index scan. Anyone know what to do? I'd wonder if the type conversion is causing you problems. CURRENT_TIMESTAMP - INTERVAL '10 minutes' is a timestamp with time zone while the column is

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Tom Lane
Matthew T. O'Connor [EMAIL PROTECTED] writes: VACUUM FULL ANALYZE every 3 hours seems a little severe. If rows are only deleted once a day, that's a complete waste of time, indeed. I'd suggest running a plain VACUUM just after the deletion pass is done. ANALYZEs are a different matter and

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Harmon S. Nine
THAT WAS IT!! Thank you very much. Is there a way to change the type of "CURRENT_TIMESTAMP" to "timestamp without time zone" so that casting isn't needed? BTW, isn't this a bug? -- Harmon Stephan Szabo wrote: On Mon, 26 Jul 2004, Harmon S. Nine wrote: However, we can't get

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Litao Wu
Hi, How about changing: CURRENT_TIMESTAMP - INTERVAL '10 minutes' to 'now'::timestamptz - INTERVAL '10 minutes' It seems to me that Postgres will treat it as a constant. Thanks, --- Tom Lane [EMAIL PROTECTED] wrote: Matthew T. O'Connor [EMAIL PROTECTED] writes: VACUUM FULL ANALYZE every 3

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Tom Lane
Litao Wu [EMAIL PROTECTED] writes: How about changing: CURRENT_TIMESTAMP - INTERVAL '10 minutes' to 'now'::timestamptz - INTERVAL '10 minutes' It seems to me that Postgres will treat it as a constant. Yeah, that works too, though again it might burn you if used inside a function or

Re: [PERFORM] Timestamp-based indexing

2004-07-26 Thread Christopher Kings-Lynne
It seems to me that Postgres will treat it as a constant. Yeah, that works too, though again it might burn you if used inside a function or prepared statement. What you're doing here is to push the freezing of the now value even further upstream, namely to initial parsing of the command. What I