Re: [PERFORM] Performance indexing of a simple query

2005-08-26 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Uh, the plain english and the SQL don't match. That query will find > every job that was NOT running at the time you said. No, I think it was right. But anyway it was just an example. > On Wed, Aug 24, 2005 at 07:42:00PM -0400, Tom Lane wrote: >> AFAI

Re: [PERFORM] Performance indexing of a simple query

2005-08-26 Thread Jim C. Nasby
On Wed, Aug 24, 2005 at 07:42:00PM -0400, Tom Lane wrote: > Mark Fox <[EMAIL PROTECTED]> writes: > > The sort of queries I want to execute (among others) are like: > > SELECT * FROM jobs > > WHERE completion_time > SOMEDATE AND start_time < SOMEDATE; > > In plain english: All the jobs that were ru

Re: [PERFORM] Performance indexing of a simple query

2005-08-24 Thread Tom Lane
Mark Fox <[EMAIL PROTECTED]> writes: > The sort of queries I want to execute (among others) are like: > SELECT * FROM jobs > WHERE completion_time > SOMEDATE AND start_time < SOMEDATE; > In plain english: All the jobs that were running at SOMEDATE. AFAIK there is no good way to do this with btree

Re: [PERFORM] Performance indexing of a simple query

2005-08-24 Thread Jim C. Nasby
Try CREATE INDEX start_complete ON jobs( start_time, completion_time ); Try also completion_time, start_time. One might work better than the other. Or, depending on your data, you might want to keep both. In 8.1 you'll be able to do bitmap-based index combination, which might allow making use of