Skip site navigation (1) Skip section navigation (2)

Re: SELECT * FROM <table> LIMIT 1; is really slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Manfred Koizar <mkoi-pg(at)aon(dot)at>,David Blasby <dblasby(at)refractions(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SELECT * FROM <table> LIMIT 1; is really slow
Date: 2004-05-28 19:48:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> On Fri, May 28, 2004 at 03:19:29PM -0400, Tom Lane wrote:
>> We'd still need a plain CommandCounterIncrement facility, which means
>> that actually a subtransaction would have to be a group of CIDs not just
>> one.

> Right, this is why I suggested runlength (the group is contiguous).

Not necessarily.

> Right.  We only need to store the "borders" though.  Not even that: only
> the start, because the end is what is current at AbortSubTransaction()
> time.

Nope.  Think about sub-subtransactions.

A runlength encoding might be worth using, though, since you're right
that subxacts would tend to get runs of consecutive CIDs.

In theory we could also use a runlength representation for the master
bitmap of aborted CIDs, but that would be costly since you would have to
do a search, and not just a trivial index, to check the state of a
particular CID.  My inclination would be to stick with a bitmap for now.
It'd be easy enough to revise the implementation later if that gut feel
proves out wrong.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Magnus HaganderDate: 2004-05-28 19:50:22
Subject: Re: Win32, PITR, nested transactions, tablespaces
Previous:From: Alvaro HerreraDate: 2004-05-28 19:36:15
Subject: Re: SELECT * FROM <table> LIMIT 1; is really slow

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group