Skip site navigation (1) Skip section navigation (2)

Re: Why does a simple query not use an obvious index?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mr Pink <mr_pink_is_the_only_pro(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Why does a simple query not use an obvious index?
Date: 2004-08-30 02:23:56
Message-ID: 18966.1093832636@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Mr Pink <mr_pink_is_the_only_pro(at)yahoo(dot)com> writes:
>>> AFAIK postgres doesn't peek at values used in a query when optimizing 
>> 
>> Of course it does.

> But not ones returned by a function such as now(), or when you use
> bind variables, as Tom aptly explained.

FWIW, 8.0 does have the ability to use the values of bind variables for
planning estimation (Oliver Jowett did the work for this).  The main
issue in the way of dealing with now() is that whatever we did to now()
would apply to all functions marked "stable", and it's a bit
nervous-making to assume that they should all be treated this way.
Or we could introduce more function volatility categories, but that's
not much fun either.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Mr PinkDate: 2004-08-30 07:38:41
Subject: Re: Why does a simple query not use an obvious index?
Previous:From: Mr PinkDate: 2004-08-30 02:09:54
Subject: Re: Why does a simple query not use an obvious index?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group