Re: [SQL] Deleting indexes before vacuum? - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] Deleting indexes before vacuum?
Date
Msg-id 7175.943117272@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] Deleting indexes before vacuum?  (Oleg Bartunov <oleg@sai.msu.su>)
Responses Re: [SQL] Deleting indexes before vacuum?  (Oleg Bartunov <oleg@sai.msu.su>)
RE: [SQL] Deleting indexes before vacuum?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-sql
Oleg Bartunov <oleg@sai.msu.su> writes:
> The question is: what's the right way to do drop index/vacuum/create ?
> Do I need transaction ?

VACUUM should not be run inside a transaction block.  (I am planning to
make the code enforce this for 7.0, but it doesn't yet.)  So you can't
protect the whole sequence with a transaction.  AFAICS the only real
problem is that if you are depending on UNIQUE indexes to catch
attempts to insert duplicate data, an insertion that got in between
the drop and recreate wouldn't get checked.

I have been toying with the notion of ripping out the existing VACUUM
index handling code and putting in fresh code that would simply do an
index drop and rebuild ;-).  This could happen inside VACUUM's exclusive
lock on the table, so it'd be perfectly safe whereas doing it the manual
way is not.  But I do not want to do this unless Vadim approves it as a
good idea --- perhaps the existing index-vacuuming code can be fixed to
be an even better solution than this.  I haven't looked at the code to
understand why it's so slow or whether there's a way to make it better.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Pham, Thinh"
Date:
Subject: RE: [SQL] Deleting indexes before vacuum?
Next
From: Oleg Bartunov
Date:
Subject: Re: [SQL] Deleting indexes before vacuum?