Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan

From: Tiago Antão <tra(at)fct(dot)unl(dot)pt>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
Date: 2000-08-21 12:34:49
Message-ID: Pine.LNX.4.21.0008211319340.24628-100000@eros.si.fct.unl.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

On Mon, 21 Aug 2000, Hannu Krosing wrote:

> And predictability is GOOD ;)
>
> I would even suggest that PG would warn about or even refuse to run
> queries
> that have both nextval and curval of the same sequence inside them
> (and pre-evaluate nextval) as only that case has _any_ predictability.

Isn't the problem more general than just nextval? Any user defined
function with side-effects would be a problematic one... plus a user
defined function might not be constant:
select ... from ... where x in (select side_effects(x) ...)
On correlated subqueries there is no guarantee of being constant.

In Prolog, which is a declarative language with some similarities to
relational algebra the ideia is: "if you use predicates with side effects,
then you're on your own".

Tiago
PS - Apologies for any irrelevant comment, I'm just starting to look to pg
code.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2000-08-21 13:59:06 Re: Bug tracking (was Re: +/- Inf for float8's)
Previous Message Tiago Antão 2000-08-21 12:18:38 Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan