Re: newbie ?'s
От | Gregory Wood |
---|---|
Тема | Re: newbie ?'s |
Дата | |
Msg-id | 00a601c0ce59$2484d470$7889ffcc@comstock.com обсуждение исходный текст |
Ответ на | newbie ?'s ("Clayton Vernon" <cvernon@enron.com>) |
Список | pgsql-general |
3) I've been told PostgreSQL databases must be periodically "rebuilt" so to speak, ("vacuumed"). Is this easy to do on-the-fly? Rapid? Or, does the db need to go down awhile? Not so much rebuilt, but just cleaned up. My understanding is that deleted records (and outdated copies of UPDATEd records) are removed, and statistics are compiled that helps the planner determine the best way to fill your queries. It's pretty easy to do on the fly... VACUUM; or better yet VACUUM ANALYZE; from the SQL prompt, or 'vacuumdb' from the command line. This can be done on a running database, but I'd recommend setting up a cron job to do it when the database is not very busy (i.e. 4AM or some other off-hour). The operational time depends on the size of your database; our relatively small databases (no more than 60K records in a given table) only take a few minutes. Not quite rapid, but not terribly painful either. 4) I can't find anything yet in the docs on on-the-fly backups of the db. Can you simply copy the directory, or will this not have integrity? What is the best strategy to study for backing up of databases that may be in use 7x24? You'll want to look for the pg_dump utility. There's plenty of documentation on this (including a nice man page), so I won't go into detail. But you can run this on a cron job as well. pg_dump should back up the entire database, including the schema, although it has options to dump data or schema only. It even does it in a nice text format, so you can even go in with your favorite text editor and modify the schema or do whatever you want. When you need to restore, just pipe the pg_dump'ed file into psql and your have your database. Like VACUUM, you can run pg_dump at any time from the command line. I'll let those wiser and more knowledgable answer the other questions... Greg
В списке pgsql-general по дате отправления: