Re: speeding up COUNT and DISTINCT queries - Mailing list pgsql-performance

From Josh Berkus
Subject Re: speeding up COUNT and DISTINCT queries
Date
Msg-id 200303140910.06416.josh@agliodbs.com
Whole thread Raw
In response to Re: speeding up COUNT and DISTINCT queries  (Max Baker <max@warped.org>)
List pgsql-performance
Max,

> I'm not starting with fresh data every time, I'm usually checking for
> an existing record, then setting a timestamp and a boolean flag.
>
> I've run some profiling and it's about 8000-10,000 UPDATEs every 4
> hours.  These are accompanied by about 800-1000 INSERTs.

If these are wide records (i.e. large text fields or lots of columns ) you may
want to consider raising your max_fsm_relation in postgresql.conf slightly,
to about 15,000.

You can get a better idea of a good FSM setting by running VACUUM FULL VERBOSE
after your next batch (this will lock the database temporarily) and seeing
how many data pages are "reclaimed", in total, by the vacuum.  Then set your
FSM to at least that level.

And has anyone mentioned REINDEX on this thread?

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-performance by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Postgresql performance
Next
From: Aaron Krowne
Date:
Subject: postgresql meltdown on PlanetMath.org