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
--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance