Обсуждение: Too much time to delete 19000 rows

Поиск
Список
Период
Сортировка

Too much time to delete 19000 rows

От
"Ezequias Rodrigues da Rocha"
Дата:
Hi list,<br /><br />I am having many problems to delete a table with only 19000 rows.<br /><br />The selection takes
lessthan 1 second but on delete I wait more than 4 minutes and notthing. Can someone tell me what could happen ? <br
/><br/>I tryed only one transaction but it does not work too:<br /><br style="font-weight: bold;" /><pre
class="PROGRAMLISTING"><spanstyle="font-weight: bold;">BEGIN WORK;</span><br style="font-weight: bold;" /><span
style="font-weight:bold;"> 
delete from base.ticket where session_id = 17 and cash_id = 99 and promo_id = 5;</span><br style="font-weight: bold;"
/><spanstyle="font-weight: bold;">COMMIT WORK; </span><br /><br />I just think it could be occuring becouse of many
constraints(7 at all) 
<br /></pre><br />Please any help is welcomed.<br /><br />Regards<br />Ezequias<br clear="all" /><br />-- <br />
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br
/>                                  Atenciosamente(Sincerely) <br />                        Ezequias Rodrigues da
Rocha<br/> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br />A pior das democracias ainda é
melhordo que a melhor das ditaduras<br />The worst of democracies is still better than the better of dictatorships <br
/><ahref="http://ezequiasrocha.blogspot.com/">http://ezequiasrocha.blogspot.com/</a> 

Re: Too much time to delete 19000 rows

От
Andrew Sullivan
Дата:
On Fri, Oct 06, 2006 at 03:10:01PM -0300, Ezequias Rodrigues da Rocha wrote:
> 
> BEGIN WORK;
> delete from base.ticket where session_id = 17 and cash_id = 99 and promo_id 
> = 5;
> COMMIT WORK;

Try putting EXPLAIN ANALYSE on the beginning to see what's going on. 
That said. . .

> I just think it could be occuring becouse of many constraints (7 at all)

. . .it could be, yes.  Are all the other tables &c. indexed
correctly?  VACUUMed and ANALYSEd?

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
The whole tendency of modern prose is away from concreteness.    --George Orwell


Re: Too much time to delete 19000 rows

От
Tom Lane
Дата:
"Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com> writes:
> The selection takes less than 1 second but on delete I wait more than 4
> minutes and notthing. Can someone tell me what could happen ?

Perhaps foreign keys referencing this table and no indexes on the
referencing columns?  You're not required to have an index on the
referencing side, but you pay for it when you update or delete in
the master table...
        regards, tom lane