Re: help required in design of database

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: help required in design of database
Дата
Msg-id 43F0723B.3040505@logix-tt.com
обсуждение исходный текст
Ответ на help required in design of database  (david drummard <vijayspam@gmail.com>)
Список pgsql-performance
Hi, David,

david drummard wrote:

> 1) create a new table every time a new feed file comes in. Create table
> with indexes. Use the copy command to dump the data into the table.

Its faster to obey the following order:

- Create the table
- COPY the data into the table
- Create the indices
- ANALYZE the table.

and probably CLUSTER the table on the most-used index, between index
creation and ANALYZE. You also might want to increase the statistics
target on some columns before ANALYZE, depending on your data.

> 2) rename the current table to some old table name and rename the new
> table to current table name so that applications can access them directly.

You can also use a view, and then use CREATE OR REPLACE VIEW to switch
between the tables.

But two table renames inside a transaction should do as well, and
shorten the outage time, as with the transaction encapsulation, no
external app should see the change inside their transaction.

HTH,
Markus


--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

В списке pgsql-performance по дате отправления:

Предыдущее
От: PFC
Дата:
Сообщение: Re: 10+hrs vs 15min because of just one index
Следующее
От: "Tim Jones"
Дата:
Сообщение: Re: joining two tables slow due to sequential scan