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

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches

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

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                      
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment: relscan-split.patch
Description: text/x-diff (20.9 KB)
Attachment: relscan_internal.h
Description: text/x-chdr (3.5 KB)


pgsql-patches by date

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

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