From: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
---|---|
To: | Denis <denis(at)startsiden(dot)no> |
Cc: | pgsql-sql(at)postgresql(dot)org, denis(at)startsiden(dot)no, gry(at)kvinneguiden(dot)no |
Subject: | Re: slow DELETE queries |
Date: | 2002-06-20 15:01:13 |
Message-ID: | 0gp3huoagdqn6hs4di0f41r1pi79rttlkj@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 20 Jun 2002 15:23:53 +0200, Denis <denis(at)startsiden(dot)no> wrote:
>I traced the queries slowing it all down to this snippet in the debug log:
>DELETE FROM phpbb_search_wordlist WHERE word_id IN (
>SELECT word_id FROM phpbb_search_wordmatch WHERE word_id IN (
>SELECT word_id FROM phpbb_search_wordmatch WHERE post_id IN (70535)
>GROUP BY word_id) GROUP BY word_id HAVING COUNT(word_id) = 1)
Denis,
IN is known to be problematic; try to use EXISTS or =, wherever
possible. Can you rewrite your innermost where clause to WHERE
post_id = 70535?
Also create an index on phpbb_search_wordmatch.post_id.
If it's still too slow, give us some more information:
Is word_id unique in phpbb_search_wordlist?
Is (post_id, word_id) unique in phpbb_search_wordmatch?
How many rows are in your tables?
Servus
Manfred
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-06-20 16:10:48 | Re: Which one is faster? |
Previous Message | Arve Fahlvik | 2002-06-20 14:56:06 | Re: Assign values to array |