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: 20080612164043.GG5534@alvh.no-ip.org (view raw or flat)
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: relscan_internal.h
Description: text/x-chdr (3.5 KB)
Attachment: relscan-split.patch
Description: text/x-diff (20.9 KB)

Responses

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-2014 The PostgreSQL Global Development Group