SQL question

Brian Densmore DensmoreB at ctbsonline.com
Fri Aug 8 21:34:04 CDT 2003


Well although this is not Linux related it could easily be.
I have a somewhat large database (approx 180 million records)
that I need to delete certain "sets" from based on a foreign
key in a smaller table (approx 4 million records) and the 
records I want to delete match a field in a third table
(very small < 100 records). I ran this delete query and it ran 
for 18 hours and still didn't finish. We had to kill it
(because the server was swapping back and forth and came 
to a standstill because we only have a 1/2 gig of RAM).
Anyway, I, have two questions:
1) why should it take 18 hours to run (the delete query should
have deleted about 1/3 of the data in the database),
2) is there anyway to have a single delete query statement
do periodic commits (as really dangerous as it is)?

basically what I have is this:

table bad_marks (uid,mark)
table messages  (indice,mark,...)
table msg_elements (id,indice,...)

where bad_marks.mark 1->M/1->0 messages.mark, uid = PK
      messages.indice 1->M msg_element.indice, message.indice = PK, message.mark = indexed
      msg_element id = PK, indice = indexed
and there is no referential integrity turned on (yet).

Thanks,
Brian

"Three OS's from corporate-kings in their towers of glass, 
Seven from valley-lords where orchards used to grow, 
Nine from dotcoms doomed to die, 
one from the dark lord Gates on his dark throne 
In the Land of Redmond where the Shadows lie. 
one OS to rule them all, one OS to find them, 
one OS to bring them all and in the darkness bind them, 
In the Land of Redmond where the Shadows lie."    john thrum




More information about the Kclug mailing list