Re: DB Tuning Notes for comment...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Treat <rtreat(at)webmd(dot)net>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: DB Tuning Notes for comment...
Date: 2002-12-09 20:54:20
Message-ID: 19453.1039467260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Treat <rtreat(at)webmd(dot)net> writes:
> On Sun, 2002-12-08 at 09:41, Philip Warner wrote:
>> First of all, the free space manager is useless at managing free space if
>> it can not map all relations (including system relations and toast
>> relations). The following query should give the correct ballpark:
>>
>> select count(*) from pg_class where not relkind in ('i','v');

FSM entries aren't needed for sequences either, so more correct is

select count(*) from pg_class where relkind in ('r', 't');

> It should be noted that if you have multiple databases, you'll need to
> get the number of relations minus the system tables for each database,
> then add in the number of system tables.

You're assuming that system tables are shared, which they mostly aren't.
Summing the pg_class count over all databases (or all that get vacuumed,
anyway; you can exclude template0) will be close enough.

BTW, this neglects what seems possibly an important factor: you don't
need FSM entries for tables that are effectively read-only or insert-only
(no deletes or updates). At least in some database designs, that's a
significant number of tables.

However, I suspect that the present FSM code is not very effective at
deciding *which* tables to track if it has too few slots, so Philip's
advice of "make sure there's one for every table" may be the best in the
near term. But we need to work at improving that logic.

I have some uncommitted patches concerning the FSM management heuristics
from Stephen Marshall, which I deemed too late/risky for 7.3, but we
should get something done for 7.4. Anyone interested in playing around
in this area?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-12-09 21:05:43 psql's \d commands --- end of the line for 1-character identifiers?
Previous Message Rod Taylor 2002-12-09 20:49:50 Sequence Cleanup