From: Markus Schaber <schabi@logix-tt.com>
To: david drummard <vijayspam@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: help required in design of database
Date: Mon, 13 Feb 2006 12:49:15 +0100
Message-ID: <43F0723B.3040505@logix-tt.com> (raw)
In-Reply-To: <9c89e2490602101220i796e6913pdfa05f40bb894b97@mail.gmail.com>
References: <9c89e2490602101220i796e6913pdfa05f40bb894b97@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: schabi@logix-tt.com, vijayspam@gmail.com
Subject: Re: help required in design of database
In-Reply-To: <43F0723B.3040505@logix-tt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox