Re: NOLOGGING option, or ?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: NOLOGGING option, or ?
Дата
Msg-id 200506012205.j51M5DF03365@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: NOLOGGING option, or ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: NOLOGGING option, or ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: NOLOGGING option, or ?  (Hannu Krosing <hannu@tm.ee>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: NOLOGGING option, or ?
Следующее
От: "Meredith L. Patterson"
Дата:
Сообщение: Re: Google's Summer of Code ...