Re: Index speeds up one row table (why)?

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Dave E Martin XXIII <postgresql-to(dot)dave(at)dave(dot)to>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index speeds up one row table (why)?
Date: 2003-06-01 12:14:15
Message-ID: 1054469655.11968.109.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

sending thread to -performance from -bugs

On Sun, 2003-06-01 at 03:20, Dave E Martin XXIII wrote:
> Rod Taylor wrote:
>
> >An 8 k page will hold approx 140 tuples based on your structure. So,
> >for every ~100 updates you'll want to run vacuum (regular, not full) on
> >the table
>
> Alas, for this application, that means a vacuum once every 5 seconds or
> so. I'll see if I can set up a separate little task to do that (I assume
> at this rate, its better to just keep a connection open, than
> setup/teardown). I don't suppose there is a way to get a trigger to do a
> vacuum (which doesn't want to be in a transaction) (thinking it could
> check for id mod 100=0 or something)? I also assume a few pages isn't
> going to be that bad (just don't let it get to 11000 8).

Sorry... Vacuum cannot be triggered -- nor would you want it to be.
There really isn't anything wrong with vacuuming once every 5 seconds or
so, as it'll take a very short time if there is only a page or so to
deal with.

Setup a script to connect, issue a vacuum, count to 5, issue a vacuum,
count to 5, etc.

More than one page and you will want an index. Having an index is only
going to slow things down in the long run as indexes will not shrink
with a vacuum in 7.3 (7.4 puts an effort towards correcting this). This
means you'll be running REINDEX every couple of minutes, which of course
locks the table, where standard vacuum does not.

--
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2003-06-01 15:05:36 Re: Bug in parser?
Previous Message Dave E Martin XXIII 2003-06-01 07:20:03 Re: Index speeds up one row table (why)?

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2003-06-01 19:04:09 Re: Index speeds up one row table (why)?
Previous Message Rod Taylor 2003-06-01 11:56:15 Re: are views typically any faster/slower than