db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Monica Ferrero <MFerr...@accelrys.com>
Subject RE: Performance deleting lots of rows from a table
Date Wed, 14 Jan 2009 15:27:10 GMT
Thanks Bryan.

I may try this, but I doubt it be any quicker as this table can get pretty big (millions of
rows), and when a new set of rows gets inserted for a result I  know it takes several seconds
(for like a 100.000 rows), so doing so for most of the contents of the table I think it would
take far too long.

Thanks for the suggestion,


-----Original Message-----
From: Bryan Pendleton [mailto:bpendleton@amberpoint.com]
Sent: 14 January 2009 15:19
To: Derby Discussion
Subject: Re: Performance deleting lots of rows from a table

> I need to delete a considerable number of rows from a table, and it is
> taking too long.  The operation takes equally long from ij, so I think
> it is independent of my application code.

As an alternate technique, you could try instead copying the rows that
you want to keep to a new table, then dropping the old table and switching
to the new table:

  - create new table with different table name, but same column definitions
  - insert into new table select rows-to-keep from current table
  - drop current table
  - rename new table to have same name as current table

You might benchmark this technique, to see if it is any faster.


Accelrys Limited (http://accelrys.com)
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
Registered in England: 2326316

View raw message