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