Re: Large Table Deletes



On Jun 15, 7:54 pm, Art Kagel <art.ka...@xxxxxxxxx> wrote:
The large number of locks is why I wrote dbdelete.  It holds no SELECT locks
while it is deleting and no delete locks while it is selecting.  It actually
selects 8192 rowids (all that fit into the until recently maximum fetch
buffer of 32K - that has been expanded to 4GB fairly recently and I'm in the
process of updating dbdelete and dbcopy to take advantage of the increase)
and uses that list to build a maximum length (64K) DELETE ... WHERE ROWID IN
(...) statement and execute it.  Each 8192 deletes is committed as a single
transaction, so relatively few locks are held.  If you try to fetch a rowid
and delete it then fetch the next one etc, all while the SELECT cursor is
open, your app will run MUCH slower.

Art

Well slow is relative and like I said, you could always fetch the rows
in to a memory buffer or buffers and then run through the buffers
pretty quick.
It all depends on how fancy you want to get. You could do this in
parallel with each delete in a separate connection and you offset your
position in the list of rowids by a large enough amount so that the
rows are most likely not going to be next to each other.

ESQL/C is your friend. ;-)


The point is that there are many ways to slice and dice this without
crushing your machine.

.



Relevant Pages

  • Re: What Id Like to See in Delphi
    ... When your main TDataSet descendant is updated for whatever reason, then your Clone is updated from the TDataSet's _buffer_. ... Or IOW, The TCloneDataSet is expected to work in the same way in which TDBGrid issues a fetch request to TDataSet and is TDataSet's responsibility to decide from where it fetches its records. ...
    (borland.public.delphi.non-technical)
  • Re: Row count from REF CURSOR
    ... The SQL for the cursor is dynamically built in the procedure ... :> In this particular system, we have stringent audit requirements, such ... ROWIDs to fetch the actual rows -- that way the record select is done once, ...
    (comp.databases.oracle.misc)
  • Re: Non blocking spin lock..
    ... then later complete the fetch of buffer_to_read. ... from buffer'. ... fetch data across a pointer dereference. ... Write ordering is *not* part of the x86 specification. ...
    (comp.programming.threads)
  • Re: An analogic ALU
    ... exemple) an then fetch the result using a DAC followed by a buffer. ...
    (comp.arch.arithmetic)
  • Re: WHY WOULD ANYBODY TRUST A HIPPY......
    ... I doubt you'll get a reply from fetch on that one. ... being built such that he can no longer enjoy that buffer and privacy. ... He fails to grasp the notion, though, that the neighborhod that he ... lives in now was, at one time, new and undoubtedly encroached on ...
    (rec.sport.disc)