Re: having indexes when clearing tables

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: nuno <wegein(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: having indexes when clearing tables
Date: 2006-07-12 03:46:05
Message-ID: 20060712034605.GA29122@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jul 09, 2006 at 20:35:39 -0700,
nuno <wegein(at)gmail(dot)com> wrote:
> hi there.
>
> i'm trying to clear data in a table but somehow it takes way too much
> time than i once expected (i'm using the formal 'delete from xxx' type
> of query.).
>
> this table's got several foreign keys and i suspect that is why it
> takes longer than expected.

If there are foreign keys referencing the table you are deleting from, then
it can be very benificial to have indexes on those tables. Having an index
on the table you are deleting from isn't useful when deleting all of the rows
in the table.

>
> my question is that
> would having indexes increase query performance when clearing tables?
> or could anyone suggest me any ways to increase performance of the
> query in such cases?
>
> thanks very much.
>
> regards, nuno
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ken Johanson 2006-07-12 04:39:32 8.2 Beta ETA
Previous Message Bruno Wolff III 2006-07-12 02:54:38 Re: doesn't recognize "!=-" (not equal to a negative value)