backup & recover data in postgresql I want to backup postgresql data,
right now I use disable insert,update,delete in my application level, become readonly mode.  

But I'm wondering what happen if insert,update,delete during dump database,
how to prevent it with postgresql function?
does dump automatic lock(insert,update,delete) table,
or is there any method do this, lock(insert,update,delete) and dump in same query? 

my dump query:
pg_dump -U postgres -f backup/dbname.sql dbname
You don't need to disable writes to the database while pg_dump is running. It's designed to create consistent backups by default. Quoting the manual:


  pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently.  pg_dump does not block other users accessing the database (readers or writers).