Page 1 of 1

Logging...

Posted: Tue Mar 10, 2009 1:03 am
by swraman
Hi,

Is it a bad idea to store frequently updated information in a file on a server?

The reason I want to use a file on the server and not a db is: I am working on a script that uses a pgsql database, and I want to store every query in which data is submitted to the server (ie. every query that adds info or updates the database). This would be for backup/transfer purposes.

should I just get to it and write a backup script that reads all the tables' rows' data and generates a backup sql file, or will this cheap workaround work? Is it bad for server load?

Thanks

Re: Logging...

Posted: Tue Mar 10, 2009 1:39 am
by Chris Corbyn
I'd be surprised if PgSQL doesn't already have a feature that does this for you, a bit like MySQL's binlog.

If PgSQL can handle replication within a cloud of DB servers then it will most likely track queries somewhere in this way.

EDIT | To directly answer your question, writing to files on disk is probably fine provided your code is well written. This is exactly what happens with most services that are running on UNIX-like systems (they write log entries to files in /var/log or wherever). You'll need to make sure the file is locked during write processes however.