Search Postgresql Archives

Re: Slow cross-machine read on one table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rob Richardson wrote:
> The slow access seems to be happening with a single table.  Here's the
> query:

Can you post EXPLAIN ANALYZE output?

> This query took about 75 seconds. 
>  
> I ran PGAdmin on the same machine that the application is running on,
> and executed the same query on the same database.  It took about 30
> milliseconds. 

In your application, are you using server-side prepared statements with
query parameters for some of the values in that query?

Try testing through PGAdmin / psql using PREPARE (with the same
parameter placeholders as your app uses) then EXECUTE, instead of a
straight SELECT.

If you get much slower execution that way, it'll be because the planner
doesn't know specific values for the parameter placeholders when
planning the query, so it can't make use of knowledge gained from table
statistics like "almost all values in the 'archived' column are zero'.

--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux