On Aug 9, 4:14 pm, g...@turnstep.com ("Greg Sabino Mullane") wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: RIPEMD160 > > > I'm writing a short script which, as part of its normal operation, > > performs a SUM on values from a Postgresql database. When running the > > summation query from the command line interface of Postgresql, it > > looks like this: > > > dev=> EXPLAIN ANALYZE SELECT SUM(bytes) AS bytes FROM > > A command-line explain won't run the same plan as a prepared > statement. See: > > http://blog.endpoint.com/2008/12/why-is-my-function-slow.html > > Also try setting $dbh->{pg_server_prepare} = 0; and see > if the time changes. > > - -- > Greg Sabino Mullane g...@turnstep.com
Setting that on the statement handle does, indeed, help. Thanks for the tip, and for the link which has been quite illuminating! Erik