On Wed, Mar 23, 2011 at 8:26 AM, Uwe Bartels <uwe.bartels@xxxxxxxxx> wrote: > Hi Brad, > > yes. that's the question.... > in the source code in freelist.c there is something that I don't understand. > > This is the first try to get a free page. The second try scans used buffers. > What makes me wonder is the why postgres is checking for <<buf->usage_count > == 0>> > where usage_count is supposed to be NULL initially. The code comment preceding that check seems to explain that it is probably not needed but simply done from an abundance of caution. > /* > * If the buffer is pinned or has a nonzero usage_count, we cannot > use > * it; discard it and retry. (This can only happen if VACUUM put a > * valid buffer in the freelist and then someone else used it before > * we got to it. It's probably impossible altogether as of 8.3, but > * we'd better check anyway.) Seems like maybe an Assert would be called for. Cheers, Jeff -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance