Re: key = currval('tab_key_seq') choses SEQSCAN?!

From: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date: 2004-02-25 22:08:24
Message-ID: 200402251908.24347.martin@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El Mié 25 Feb 2004 18:52, Brandon Craig Rhodes escribió:
>
> But this same table suddenly becomes unwilling to use an index scan if
> the target value is the result of the currval() function:
>
> # explain select * from changes where change =
> currval('changes_change_seq'); QUERY PLAN

Try with this:

explain select * from changes where change = (SELECT
currval('changes_change_seq'))::INT;

--
19:06:01 up 92 days, 1:15, 3 users, load average: 0.72, 0.37, 0.24
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sally Sally 2004-02-25 22:17:47 reindexing, pg_class (and other system tables)
Previous Message Brandon Craig Rhodes 2004-02-25 21:52:35 key = currval('tab_key_seq') choses SEQSCAN?!