Re: Deleting takes days, should I add some index?

2021-02-25 Thread Alexander Farber
Thank you for the explanation, David On Thu, Feb 25, 2021 at 9:49 PM David Rowley wrote: > > Since your foreign keys perform a cascade delete on the tables > referencing the tables you're deleting from, any records in those > referencing tables will be deleted too. You must also look at those

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 22:33 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Thank you, Pavel! > > I didn't even think about trying to "explain analyze" deletion of just 1 > record - > > On Thu, Feb 25, 2021 at 10:04 PM Pavel Stehule > wrote: > >> čt 25. 2. 2021 v 19:39 odesílatel

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Alexander Farber
Thank you, Pavel! I didn't even think about trying to "explain analyze" deletion of just 1 record - On Thu, Feb 25, 2021 at 10:04 PM Pavel Stehule wrote: > čt 25. 2. 2021 v 19:39 odesílatel Alexander Farber < >> alexander.far...@gmail.com> napsal: >> >>> The question is why does the command

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 22:02 odesílatel Pavel Stehule napsal: > Hi > > čt 25. 2. 2021 v 19:39 odesílatel Alexander Farber < > alexander.far...@gmail.com> napsal: > >> Pavel, thank you for asking! >> >> I have put the anonymized dump of my database at: >> >> http://wordsbyfarber.com/words_dev.sql.gz

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
Hi čt 25. 2. 2021 v 19:39 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Pavel, thank you for asking! > > I have put the anonymized dump of my database at: > > http://wordsbyfarber.com/words_dev.sql.gz (beware, it is a 1.3 GB > download) > > The question is why does the

Re: Deleting takes days, should I add some index?

2021-02-25 Thread David Rowley
On Fri, 26 Feb 2021 at 02:06, Alexander Farber wrote: > However the deletion still takes forever and I have to ctrl-c it: > > # delete from words_games where created < now() - interval '12 month'; > > Do you please have any further suggestions? > > When I try to prepend "explain analyze" to the

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Alexander Farber
Pavel, thank you for asking! I have put the anonymized dump of my database at: http://wordsbyfarber.com/words_dev.sql.gz (beware, it is a 1.3 GB download) The question is why does the command take days (when I tried last time): delete from words_games where created < now() - interval '12

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 14:36 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Hi Pavel, > > trying to follow your advice "You should check so all foreign keys have an > index" I look at the table where I want to delete older records: > > # \d words_games >

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Alexander Farber
Hi Pavel, trying to follow your advice "You should check so all foreign keys have an index" I look at the table where I want to delete older records: # \d words_games Table "public.words_games" Column | Type | Collation | Nullable |

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 14:06 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Hello, revisiting an older mail on the too long deletion times (in > PostgreSQL 13.2)... > > I have followed the advices here, thank you - > > On Fri, Nov 27, 2020 at 4:15 PM Guillaume Lelarge > wrote: >

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Alexander Farber
Hello, revisiting an older mail on the too long deletion times (in PostgreSQL 13.2)... I have followed the advices here, thank you - On Fri, Nov 27, 2020 at 4:15 PM Guillaume Lelarge wrote: > Le ven. 27 nov. 2020 à 16:05, Alvaro Herrera a > écrit : > >> On 2020-Nov-27, Alexander Farber wrote:

Re: Deleting takes days, should I add some index?

2020-11-27 Thread Guillaume Lelarge
Le ven. 27 nov. 2020 à 16:05, Alvaro Herrera a écrit : > 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

Re: Deleting takes days, should I add some index?

2020-11-27 Thread Alvaro Herrera
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