Re: NOLOGGING option, or ? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: NOLOGGING option, or ?
Date
Msg-id 200506012205.j51M5DF03365@candle.pha.pa.us
Whole thread Raw
In response to Re: NOLOGGING option, or ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: NOLOGGING option, or ?
Re: NOLOGGING option, or ?
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> Not unless you are proposing to change COPY to acquire a lock strong
> >> enough to lock out other writers to the table for the duration ...
> 
> > Well, if the table is initally empty, what harm is there in locking the
> > table?
> 
> You cannot *know* whether it is empty unless you lock the table before
> you look.  So your argument is circular.
> 
> I think this only makes sense as an explicit option to COPY, one of the
> effects of which would be to take a stronger lock than COPY normally does.

One idea would be to look at the table file size first.  If it has zero
blocks, lock the table and if it still has zero blocks, do the no-WAL
copy.

I hate to add a flag to a command when we can automatically handle it
ourselves.

Now, you mentioned the idea of doing the optimization in tables that
already have data, and if we do that, we would need a flag because the
lock is stronger than what we have now.

What we could do is to do no-WAL automatically for empty tables (like
when a database is first loaded), and use the flag for cases where the
tables is not zero pages.  The fact is that database loads are a prefect
case for this optimization and old dumps are not going to have that flag
anyway, and automatic is better if we can do it.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: NOLOGGING option, or ?
Next
From: "Meredith L. Patterson"
Date:
Subject: Re: Google's Summer of Code ...