Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Markus Schulz <msc(at)antzsystem(dot)de>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds
Date: 2013-02-23 15:54:26
Message-ID: 5128E632.2040209@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 22.02.2013 20:10, Markus Schulz wrote:
> Am Freitag, 22. Februar 2013, 14:35:25 schrieb Heikki Linnakangas:
>> You could check what the generic plan looks like by taking the query
>> used in the java program, with the parameter markers, and running
>> EXPLAIN on that.
>
> how can i do this?
> I've tried the following in my ejb-test-function to:
>
> String query = "..."
> entitymanager.createNativeQuery(query)...;
> entitymanager.createNativeQuery("EXPLAIN ANALYZE " + query)...;
>
> but the second createNativeQuery call runs fast every time and will show the
> same plan and the first hangs after the fourth call to this function.

You can take the query, replace the ? parameter markers with $1, $2, and
so forth, and explain it with psql like this:

prepare foo (text) as select * from mytable where id = $1;
explain analyze execute foo ('foo');

On 9.2, though, this will explain the specific plan for those
parameters, so it might not be any different from what you already
EXPLAINed.

- Heikki

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2013-02-23 16:14:33 Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds
Previous Message Tom Lane 2013-02-23 10:10:18 Re: Bad query plan with high-cardinality column