RE: [SQL] Updating database

Поиск
Список
Период
Сортировка
От Jackson, DeJuan
Тема RE: [SQL] Updating database
Дата
Msg-id F10BB1FAF801D111829B0060971D839F4D72F0@cpsmail
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: updating database
Следующее
От: Daniela Mariano
Дата:
Сообщение: Entity-Relationship Diagram