Re: [SQL] Function-based index not used in a simple query

2000-05-31 Thread Tom Lane
Rostislav Opocensky <[EMAIL PROTECTED]> writes: > On Tue, 30 May 2000, Tom Lane wrote: >> The problem here is that the optimizer will only consider an indexscan >> for a clause that looks like index_key OP constant. It doesn't think > I'll consider having my index function return a `date'. Stil

Re: [SQL] Function-based index not used in a simple query

2000-05-31 Thread Rostislav Opocensky
On Tue, 30 May 2000, Tom Lane wrote: > The problem here is that the optimizer will only consider an indexscan > for a clause that looks like index_key OP constant. It doesn't think > that trunc_to_day('28.5.2000') is a constant, because you haven't told > it that it can pre-evaluate that functio

Re: [SQL] Function-based index not used in a simple query

2000-05-30 Thread Tom Lane
Rostislav Opocensky <[EMAIL PROTECTED]> writes: > SELECT * > FROM vals > WHERE trunc_to_day(timestamp) = trunc_to_day('28.5.2000'); > > Seq Scan on vals (cost=0.00..27.50 rows=10 width=44) The problem here is that the optimizer will only consider an indexs

[SQL] Function-based index not used in a simple query

2000-05-30 Thread Rostislav Opocensky
Hi all, I have run into a problem trying to optimize a select from a single table. Due to the nature of the queries our frontends issue most of the time, we have created an index that reduces the processing time a lot. The problem (index not being used) arose when I tried to do a select with n