pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Alexander Farber <alexander.farber@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Deleting takes days, should I add some index?
Date: Fri, 27 Nov 2020 12:05:12 -0300
Message-ID: <20201127150512.GA21099@alvherre.pgsql> (raw)
In-Reply-To: <CAADeyWjd5wsVznHXEvsVhLjDdo3=-WoLmDQk9n-1ZQgCPGceUg@mail.gmail.com>

On 2020-Nov-27, Alexander Farber wrote:

> Referenced by:
>     TABLE "words_chat" CONSTRAINT "words_chat_gid_fkey" FOREIGN KEY (gid)
> REFERENCES words_games(gid) ON DELETE CASCADE
>     TABLE "words_moves" CONSTRAINT "words_moves_gid_fkey" FOREIGN KEY (gid)
> REFERENCES words_games(gid) ON DELETE CASCADE
>     TABLE "words_scores" CONSTRAINT "words_scores_gid_fkey" FOREIGN KEY
> (gid) REFERENCES words_games(gid) ON DELETE CASCADE

Make sure you have indexes on the gid columns of these tables.  Delete
needs to scan them in order to find the rows that are cascaded to.

> So I ctrl-c (surprisingly not a single record was deleted; I was expecting
> at least some to be gone)

Ctrl-C aborts the transaction, so even though the rows are marked
deleted, they are so by an aborted transaction.  Therefore they're
alive.





view thread (14+ messages)  latest in thread

Message-ID: <20201127150512.GA21099@alvherre.pgsql>
Permalink:  ../20201127150512.GA21099@alvherre.pgsql/
Also on:    postgresql.org/message-id/20201127150512.GA21099@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@alvh.no-ip.org, alexander.farber@gmail.com
  Subject: Re: Deleting takes days, should I add some index?
  In-Reply-To: <20201127150512.GA21099@alvherre.pgsql>
  References: <CAADeyWjd5wsVznHXEvsVhLjDdo3=-WoLmDQk9n-1ZQgCPGceUg@mail.gmail.com> <20201127150512.GA21099@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox