Search Postgresql Archives

Re: How many records to delete ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



shulkae wrote:
I am writing a shell script which runs as a cron entry. The objective
is to delete older records from postgresql DB.

I have thousands of records. What is the optimum number of records to
delete in one delete command

as many as you need to,

   DELETE FROM yourtable AS t
       WHERE CURRENT_DATE - t.recorddate < INTERVAL '90 days';

or whatever. pooof, all records over that given parameter are deleted, about as efficiently as can be. of course, as always, the space doesn't get reclaimed until that table is vacuumed.



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux