RE: [SQL] Updating database - Mailing list pgsql-sql

From Jackson, DeJuan
Subject RE: [SQL] Updating database
Date
Msg-id F10BB1FAF801D111829B0060971D839F4D72F0@cpsmail
Whole thread Raw
List pgsql-sql
> Please help:)
>
> We have a knowledge base that needs updated every night from a large
> text file.  Currently a script deletes everything from a table and
> adds the new data.  This procedure seems to slowly cause the database
> to loose performance daily.  It also leaves our database useless for
> several hours starting at midnight.  I thought about using 2
> databases, updating one while using the other, then swapping them
> every day.  I also thought about having one db.out, then the other in.
>
> Is there a better way to do this?
>
> Thanks in advance.
>
> Charles Day
>
Why don't you just use another table to COPY the data into. Then at the
end of the copy either
LOCK, DELETE FROM, INSERT INTO, then VACUUM ANALYZE
 or
DROP, ALTER to rename the copy, recreate INDEXES, then VACUUM ANALYZE

I'd do a time test to see which uses the least amount of time.
Enjoy,
    -DEJ


> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: updating database
Next
From: Daniela Mariano
Date:
Subject: Entity-Relationship Diagram