Re: DELETE performance issues - Mailing list pgsql-general

From Tom Lane
Subject Re: DELETE performance issues
Date
Msg-id 17384.1162484843@sss.pgh.pa.us
Whole thread Raw
In response to Re: DELETE performance issues  ("Schwenker, Stephen" <SSchwenker@thestar.ca>)
Responses Re: DELETE performance issues
List pgsql-general
"Schwenker, Stephen" <SSchwenker@thestar.ca> writes:
> All the tables have primary keys and when I explain the queries, they
> use the primary key index.  I have increased the shared memory which
> only seems to help when the same table is accessed synchronously but
> this switching back and forth between tables seems to be slow.  There
> are approximately 600,000 rows in the tables.  And these tables do not
> have any references point to them but they do reference other tables.

Are you absolutely sure about that last?  Unindexed foreign key
references are the explanation nine times out of ten when someone
complains about deletes being slow.

> I'm guessing that the problem lies in loading the indexes off the disk
> each time the table switches.

For tables with only 600K rows the indexes should be plenty small enough
to fit in memory on any modern machine.  I'm thinking maybe the problem
is enormous index bloat ... does REINDEXing the tables improve matters?

> max_fsm_pages = 40000

That seems mighty small :-(.  Do a database-wide VACUUM VERBOSE and see
what it says about FSM usage in the last few lines of output.

            regards, tom lane

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_dump question
Next
From: "Gurjeet Singh"
Date:
Subject: Re: lots of values for IN() clause