Re: Adding nextval() to a select caused hang/very slow execution - Mailing list pgsql-performance
From | Eric Raskin |
---|---|
Subject | Re: Adding nextval() to a select caused hang/very slow execution |
Date | |
Msg-id | CAF9L-R4oiksGgY8AWVfpYqCnMpyPDPk8-Sct05buKmkbVM03_w@mail.gmail.com Whole thread Raw |
In response to | Re: Adding nextval() to a select caused hang/very slow execution (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: Adding nextval() to a select caused hang/very slow execution
|
List | pgsql-performance |
Eric Raskin <eraskin@paslists.com> writes:
> I have a strange situation where a base query completes in about 30 seconds
> but if I add a nextval() call to the select it never completes. There are
> other processes running that are accessing the same sequence, but I thought
> that concurrency was not an issue for sequences (other than skipped
> values).
Shouldn't be, probably ... but did you check to see if the query is
blocked on a lock? (See pg_stat_activity or pg_locks views.)
> The only change that
> causes it to be extremely slow or hang (can't tell which) is that I changed
> the select from:
> select unnest(....
> to
> select nextval('sbowner.idgen'), unnest(....
Without seeing the complete query it's hard to say much. But if
this isn't the topmost select list, maybe what's happening is that
the presence of a volatile function in a sub-select is defeating
some key plan optimization. Did you compare plain EXPLAIN (w/out
ANALYZE) output for the two cases, to see if the plan shape changes?
regards, tom lane
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Eric H. Raskin 914-765-0500 x120 or 315-338-4461 (direct)
Professional Advertising Systems Inc. fax: 914-765-0500 or 315-338-4461 (direct)
3 Morgan Drive #310 eraskin@paslists.com
Mt Kisco, NY 10549 http://www.paslists.com
pgsql-performance by date: