Re: DBI Prepared statement much slower than postgres command line execution.
[email protected] ("Greg Sabino Mullane")
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <[email protected]> |
-----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 [email protected]
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201008091713
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iEYEAREDAAYFAkxgb5oACgkQvJuQZxSWSsjRjgCdGOZrNhtb2iz3vuVcaHV16NFO
xN0Ani+4d4ZmGE/niuOjVOW2gGru8N1r
=T4y+
-----END PGP SIGNATURE-----