Re: [SQL] Indices and user defined operators

2005-06-09 Thread Richard Huxton
Tom Lane wrote: I wrote: "Dmitri Bichko" <[EMAIL PROTECTED]> writes: So, is there any way to make these operators use an index defined as above? If you've set things up so that the operators are defined by inline-able SQL functions, I'd sort of expect it to fall out for free ... Now *th

Re: [SQL] Indices and user defined operators

2005-06-08 Thread Tom Lane
I wrote: > "Dmitri Bichko" <[EMAIL PROTECTED]> writes: >> So, is there any way to make these operators use an index defined as >> above? > If you've set things up so that the operators are defined by inline-able > SQL functions, I'd sort of expect it to fall out for free ... Here's a quick proof-

Re: [SQL] Indices and user defined operators

2005-06-08 Thread Tom Lane
"Dmitri Bichko" <[EMAIL PROTECTED]> writes: > So, is there any way to make these operators use an index defined as > above? If you've set things up so that the operators are defined by inline-able SQL functions, I'd sort of expect it to fall out for free ... regards, tom l

[SQL] Indices and user defined operators

2005-06-08 Thread Dmitri Bichko
Being lazy, I've created a set of case incensitive text comparison operators: =*, <*, >*, and !=*; the function for each just does an UPPER() on both arguments and then uses the corresponding builtin operator. What would make these REALLY useful, is if when running something like: SELECT * FROM f

[SQL] Indices

2001-01-19 Thread Nikolaj Lundsgaard
Maybe a wrong mailinglist to ask this, but... Are there any plans on writing a chapter in the documentation about the implementation of indices. I know from M$ SQL Server that it is no picnic determining which indices are useful, and thick books can be written on how to make the right indices f

Re: [SQL] Indices and time spans

2000-07-31 Thread Itai Zukerman
> You need to recast the clause as something like > > WHERE posted >= (CURRENT_TIMESTAMP - '5 minutes'::TIMESPAN) > > Then you still have the problem of persuading Postgres that it should > treat the right side of this as a constant and not something to > re-evaluate at each row. In 7.0 a

Re: [SQL] Indices and time spans

2000-07-31 Thread Tom Lane
Itai Zukerman <[EMAIL PROTECTED]> writes: > I have this: > SELECT ... > FROM trade, entry > WHERE AGE( CURRENT_TIMESTAMP, posted ) <= '5 minutes'::TIMESPAN > AND trade.entryId = entry.entryId > That is, fetch all trades executed in the last 5 minutes. > This query seems

[SQL] Indices and time spans

2000-07-31 Thread Itai Zukerman
I have this: SELECT ... FROM trade, entry WHERE AGE( CURRENT_TIMESTAMP, posted ) <= '5 minutes'::TIMESPAN AND trade.entryId = entry.entryId That is, fetch all trades executed in the last 5 minutes. This query seems to run pretty slowly when trade is filled. Putting an