relscan.h split

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Patches <pgsql-patches(at)postgresql(dot)org>
Subject: relscan.h split
Date: 2008-06-12 16:40:43
Message-ID: 20080612164043.GG5534@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi,

relscan.h is very widely used -- in particular it is included by some
headers that want the IndexScanDesc and HeapScanDesc definitions in
prototypes. However, most of the time they are just passing the struct
through; they don't need to see the actual Heap/IndexScanDescData
definitions.

I propose the following patch which moves the struct definitions to a
separate new header relscan_internal.h. Files that actually need the
definitions can include the new header. They are not that many -- I
count 22 inclusions, all of them in .c files. Headers only include the
.h file, which has the benefit that since it is a lean file, it needn't
include all the other headers needed by the struct declaration.

Zdenek says that this patch changes the number of times certain headers
are opened (data gathered using dtrace):

new old diff
src/include/access/skey.h 347 465 -118
src/include/utils/rel.h 851 921 -70
src/include/access/relscan.h 340 360 -20

So it doesn't have a tremendous impact, but it does have some.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
relscan-split.patch text/x-diff 20.9 KB
relscan_internal.h text/x-chdr 3.5 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-06-12 17:04:47 Re: relscan.h split
Previous Message Tom Lane 2008-06-12 16:33:57 Re: SQL: table function support