From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] tables > 1 gig |
Date: | 1999-06-18 03:15:32 |
Message-ID: | 199906180315.XAA14659@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > > Unlinking unused segments after truncating to zero length may cause
> > > the result such as
> > >
> > > Existent backends write to the truncated file to extend
> > the relation
> > > while new backends create a new segment file to extend the
> > relation.
> >
> > How about my idea of creating a truncated file, the renaming it to the
> > table file. That keeps the table open for other open file descriptors,
> > but put a zero-length file in place in an atomic manner.
> >
>
> Sorry,I couldn't understand what you mean.
> What is differenct from truncating existent files to zero length ?
Glad to explain. Here is the pseudocode:
create temp file, make it zero length, call it 'zz'
rename(zz,tablename)
What this does is to create a zero length file, and the rename unlinks
the tablename file, and puts the zero-length file in it's place.
rename() is atomic, so there is no time that the table file does not
exist.
It allows backends that have the table open via a descriptor to keep the
table unchanged, while new backends see a zero-length file.
Does this help?
--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 1999-06-18 03:57:14 | RE: [HACKERS] tables > 1 gig |
Previous Message | Hiroshi Inoue | 1999-06-18 03:11:04 | RE: [HACKERS] tables > 1 gig |