Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Bruno Wolff III
On Tue, May 24, 2005 at 21:39:15 -0500, John A Meinel <[EMAIL PROTECTED]> wrote: > > By the way, I think doing: > > CREATE DATABASE tempdb WITH TEMPLATE = originaldb; > > Is a much faster way of doing dump and load. I *think* it would recreate > indexes, etc. If it just does a copy it may not

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread John A Meinel
SpaceBallOne wrote: What version of postgres? 8.0.2 ... but I think I've seen this before on 7.3 ... There are a few possibilities. If you are having a lot of updates to the table, you can get index bloat. And vacuum doesn't fix indexes. You have to "REINDEX" to do that. Though REINDEX has

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Tom Lane
Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: >> If I pg_dump that database then create a new database (e.g. "tempdb") >> and upload the dump file (thus making a duplicate) then the same query >> only takes 190ms !! >> Vacuum, vacuum analyse, and vacuum full analyse does not seem to have an

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Tom Lane
John A Meinel <[EMAIL PROTECTED]> writes: > By the way, I think doing: > CREATE DATABASE tempdb WITH TEMPLATE = originaldb; > Is a much faster way of doing dump and load. I *think* it would recreate > indexes, etc. If it just does a copy it may not show the dump/restore > improvement. CREATE DAT

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Christopher Kings-Lynne
Would CLUSTER / REINDEX still have an effect if our queries were done via sequential scan? SELECTS don't write to the database, so they have no effect at all on vacuuming/analyzing. You only need to worry about that with writes. This is a old database (as in built by me when i was just sta

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread SpaceBallOne
What version of postgres? 8.0.2 ... but I think I've seen this before on 7.3 ... There are a few possibilities. If you are having a lot of updates to the table, you can get index bloat. And vacuum doesn't fix indexes. You have to "REINDEX" to do that. Though REINDEX has the same lock that VACU

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread John A Meinel
SpaceBallOne wrote: Wondering if someone could explain a pecularity for me: We have a database which takes 1000ms to perform a certain query on. If I pg_dump that database then create a new database (e.g. "tempdb") and upload the dump file (thus making a duplicate) then the same query only tak

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Christopher Kings-Lynne
Can anyone explain why this may be occurring and how I might be able to keep the original database running at the same speed as "tempdb"? You're not vacuuming anywhere near often enough. Read up the database maintenance section of the manual. Then, set up contrib/pg_autovacuum to vacuum your

Re: [PERFORM] Can anyone explain this: duplicate dbs.

2005-05-24 Thread Christopher Kings-Lynne
If I pg_dump that database then create a new database (e.g. "tempdb") and upload the dump file (thus making a duplicate) then the same query only takes 190ms !! Vacuum, vacuum analyse, and vacuum full analyse does not seem to have an impact on these times. Damn, for some reason I didn't read t