Search Postgresql Archives

Deleting 100 rows which meets certain criteria

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

 



I am newbie to postgres/SQL.

I want to delete all rows exceeding 400 hours (10 days) and I want to
limit deletion of only 100 records at a time.

I was trying the following in PostgreSQL:

DELETE from mytable WHERE (now() - timestamp_field  > INTERVAL '400
hour' ) LIMIT 100;

Looks like DELETE syntax doesn't support LIMIT.

Is there any other way to achieve this?

thanks
Shul

-- 
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