Subject Re: [firebird-support] Best way to delete millions of rows
Author paul.mercea-almexa.ro
On 2016-10-29 17:53, kragh.thomas@... [firebird-support] wrote:
> Hey
>
> I have a database that needs some cleanup, in some tables i need to
> delete millions of rows. I performed the cleanup on a copy of the
> production database in a development environment, using:
>
> delete from table where created < dateadd(-6 month to current_date)
>
> followed by a count(*) on the table
>
> I know that this causes massive garbage collection, however all other
> attachments to the database, and all attachments to other databases on
> the same server stopped working, and no new attachments could be
> created until the count was completed.
>
> So my question is:
>
> Is this considered a bug in Firebird? Especially because users that
> did not access the table, and users of other databases on the server
> was affected?
>
> And how can i perform the delete on the production server without
> affecting users? When the database is used 24/7 and the tables i need
> to delete from are frequently accessed by users?
>
> The server is 2.5.5 running on CentOs - Running super classic.
>
> Best regards Thomas
I use a stored procedure to delete this kind of data. I invoke this SP
daily as a cleanup process.

Regards,
Paul Mercea