Skip site navigation (1) Skip section navigation (2)

Re: Continuous inserts...

From: "Poul L(dot) Christiansen" <plc(at)faroenet(dot)fo>
To: Joerg Hessdoerfer <Joerg(dot)Hessdoerfer(at)sea-gmbh(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Continuous inserts...
Date: 2000-08-17 14:50:00
Message-ID: 399BFB98.67D58A7D@faroenet.fo (view raw or flat)
Thread:
Lists: pgsql-sql
Isn't easier to reduce the table every day and make a daily vacuum which only
lasts a few seconds?

Joerg Hessdoerfer wrote:

> Hi!
>
> I have an application, where I have to insert data into a table at several
> rows per second, 24 hours a day, 365 days a year.
>
> After some period (a week, maybe a month) the data will be reducted to some
> degree and deleted from the table.
>
> As far as I understood, I would have to use VACUUM to really free the table
> from deleted rows - but VACUUM (esp. on a table with several million rows)
> takes some time and prevents me from inserting new data.
>
> Now, I thought I could just rename the table, inserting into a temp table, and
> switch the tables back after VACUUMing. Ideally, this should work unnoticed
> (and thus without prog. effort) on the client (inserter) side.
>
> Question: would it work to use a transaction to perform the rename?
>
> i.e.: continuous insert into table 'main' from client.
>
>  From somewhere else, execute:
>
> begin;
> alter table main rename to vac_main;
> create table main (...);
> end;
>
> would the inserter notice this? Read: would ALL inserts AT ANY TIME succeed?
>
> I know, I could simulate such functionality in the client (inserter). But it
> seems more elegant this way...
>
> Greetings,
>         Joerg
> +------****  Science & Engineering Applications GmbH  ****------+
> |                                                               |
> | Joerg Hessdoerfer                                             |
> | Leading SW developer Phone:    +49 (0)2203-962211             |
> | S.E.A GmbH           Fax:                 -962212             |
> | D-51147 Koeln        Internet: joerg(dot)hessdoerfer(at)sea-gmbh(dot)com |
> |                                http://www.sea-gmbh.com        |
> +---------------------------------------------------------------+


In response to

Responses

pgsql-sql by date

Next:From: Adams, JoeDate: 2000-08-17 15:20:25
Subject: CREATE USER through SQL possible?
Previous:From: Ross J. ReedstromDate: 2000-08-17 14:38:42
Subject: Re: car mileage summation / sledgehammer method

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group