Unix Technical Forum

Re: Deleting Records

This is a discussion on Re: Deleting Records within the Pgsql Performance forums, part of the PostgreSQL category; --> what about firing a DELETE FROM qc_session S WHERE EXISTS (SELECT * FROM item_qc_doer i WHERE i.item_id = s.item_id); ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:34 PM
=?iso-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?=
 
Posts: n/a
Default Re: Deleting Records


what about firing a

DELETE FROM qc_session S
WHERE EXISTS (SELECT *
FROM item_qc_doer i
WHERE i.item_id = s.item_id);

and

DELETE FROM item_qc_doer S
WHERE EXISTS (SELECT *
FROM item_qc_doer i
WHERE i.item_id = s.item_id);


this might be faster.

another way to speed up deletes might be disabling foreign keys.

also a SET ENABLE_SEQSCAN=FALSE; can speed up queries (force use of indices for access)


do you have a EXPLAIN for us ? do you have a index on item_id on your tables ?

questions by questions ;-)



mfg


-----Ursprüngliche Nachricht-----
Von: pgsql-performance-owner@postgresql.org
[mailtogsql-performance-owner@postgresql.org]Im Auftrag von Christian
Paul B. Cosinas
Gesendet: Donnerstag, 20. Oktober 2005 10:44
An: pgsql-performance@postgresql.org
Betreff: [PERFORM] Deleting Records


Hi!

I'm experiencing a very slow deletion of records. Which I thin is not right.
I have a Dual Xeon Server with 6gig Memory.
I am only deleting about 22,000 records but it took me more than 1 hour to
finish this.

What could possibly I do so that I can make this fast?

Here is the code inside my function:

FOR temp_rec IN SELECT * FROM item_qc_doer LOOP
DELETE FROM qc_session WHERE item_id = temp_rec.item_id;
DELETE FROM item_qc_doer WHERE item_id = temp_rec.item_id;
END LOOP;

Item_qc_oder table contains 22,000 records.


I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com