[GENERAL] Deleting 100 rows which meets certain criteria

2009-12-30 Thread shulkae
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 syn

[GENERAL] converting tables to XML and back

2010-01-04 Thread shulkae
We have few tables which we would like to convert to XML and store it. Another requirement is to convert the stored XML file back to the original tables. This helps us to clone a system. I was thinking to use Perl XML Simple module to generate XML files. How do I again re-create tables from XML?

[GENERAL] How many records to delete ?

2010-01-06 Thread shulkae
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 ( my script will delete records in a loop and I want to ensure that the swap file