pgsql: Further examination of ltsReleaseBlock usage shows that it's got - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Further examination of ltsReleaseBlock usage shows that it's got
Date
Msg-id 20060307234624.C92BE9DC820@postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Further examination of ltsReleaseBlock usage shows that it's got a
performance issue during regular merge passes not only the 'final merge'
case.  The original design contemplated that there would never be more
than about one free block per 'tape', hence no need for an efficient
method of keeping the free blocks sorted.  But given the later addition
of merge preread behavior in tuplesort.c, there is likely to be about
work_mem worth of free blocks, which is not so small ... and for that
matter the number of tapes isn't necessarily small anymore either.  So
we'd better get rid of the assumption entirely.  Instead, I'm assuming
that the usage pattern will involve alternation between merge preread
and writing of a new run.  This makes it reasonable to just add blocks
to the list without sorting during successive ltsReleaseBlock calls,
and then do a qsort() when we start getting ltsGetFreeBlock() calls.
Experimentation seems to confirm that there aren't many qsort calls
relative to the number of ltsReleaseBlock/ltsGetFreeBlock calls.

Modified Files:
--------------
    pgsql/src/backend/utils/sort:
        logtape.c (r1.20 -> r1.21)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/sort/logtape.c.diff?r1=1.20&r2=1.21)

pgsql-committers by date:

Previous
From: gsmet@pgfoundry.org (User Gsmet)
Date:
Subject: pgfouine - pgfouine: updated ChangeLog
Next
From: nwakefield@pgfoundry.org (User Nwakefield)
Date:
Subject: bizgres - bizgres: Added support for sql statement to be run on db