Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds - Mailing list pgsql-performance

From Heikki Linnakangas
Subject Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds
Date
Msg-id 5128E632.2040209@vmware.com
Whole thread Raw
In response to Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds  (Markus Schulz <msc@antzsystem.de>)
Responses Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds
List 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


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bad query plan with high-cardinality column
Next
From: Tom Lane
Date:
Subject: Re: BUG: endless lseek(.., SEEK_END) from select queries on x64 builds