Re: [PERFORM] Optimizer + bind variables

2009-11-03 Thread David Kerr
On Wed, Nov 04, 2009 at 11:02:22AM +1100, Chris wrote: - David Kerr wrote: - >On Wed, Nov 04, 2009 at 07:43:16AM +0800, Craig Ringer wrote: - >- David Kerr wrote: - No. - - This is explained in the notes here: - - http://www.postgresql.org/docs/current/static/sql-prepare.html and i've read that

Re: [PERFORM] Optimizer + bind variables

2009-11-03 Thread Chris
David Kerr wrote: On Wed, Nov 04, 2009 at 07:43:16AM +0800, Craig Ringer wrote: - David Kerr wrote: - > Does/is it possible for the PG optimizer come up with differnet plans when - > you're using bind variables vs when you send static values? - - Yes, if the bind variable form causes your DB ac

[PERFORM] Optimizer + bind variables

2009-11-03 Thread David Kerr
Does/is it possible for the PG optimizer come up with differnet plans when you're using bind variables vs when you send static values? like if my query was select * from users (add a bunch of complex joins) where username = 'dave' vs select * from users (add a bunch of complex joins) where user

Re: [PERFORM] Optimizer + bind variables

2009-11-03 Thread Craig Ringer
David Kerr wrote: > Does/is it possible for the PG optimizer come up with differnet plans when > you're using bind variables vs when you send static values? Yes, if the bind variable form causes your DB access driver to use a server-side prepared statement. Pg can't use its statistics to improve

Re: [PERFORM] Optimizer + bind variables

2009-11-03 Thread David Kerr
On Wed, Nov 04, 2009 at 07:43:16AM +0800, Craig Ringer wrote: - David Kerr wrote: - > Does/is it possible for the PG optimizer come up with differnet plans when - > you're using bind variables vs when you send static values? - - Yes, if the bind variable form causes your DB access driver to use a