Re: reorganizing partitioning code (was: Re: [HACKERS] path toward faster partition pruning)

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reorganizing partitioning code (was: Re: [HACKERS] path toward faster partition pruning)
Date: 2018-02-14 02:17:42
Message-ID: 2774e870-2523-072f-a9e0-f28a00ffe2ee@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018/02/14 10:00, Amit Langote wrote:
> Agree with the proposed reorganizing and adding a partcache.c, which I
> tried to do in the attached patch.
>
> * The new src/backend/utils/cache/partcache.c contains functions that
> initialize relcache's partitioning related fields. Various partition
> bound comparison and search functions (and then some) that work off of the
> cached information are moved. Also, since we cache partition qual,
> interface functions RelationGetPartitioQual(Relation) and
> get_partition_qual_relid(Oid) are moved too.
>
> * The new src/include/utils/partcache.h contains various struct
> definitions that are moved from backend/catalog/partition.c,
> include/catalog/partition.h, and include/utils/rel.h. Also, declarations
> of interface functions of partcache.c.

Attached updated version, where I removed #include "catalog/partition.h"
from even more places and also moved map_partition_varattnos() next to
map_variable_attnos() in rewriteManip.c.

Now, after applying the patch -

Files #including partition.h

File Line
0 src/backend/catalog/heap.c 44 #include "catalog/partition.h"
1 src/backend/catalog/partition.c 22 #include "catalog/partition.h"
2 src/backend/commands/indexcmds.c 26 #include "catalog/partition.h"
3 src/backend/commands/tablecmds.c 33 #include "catalog/partition.h"
4 src/backend/utils/cache/partcache.c 23 #include "catalog/partition.h"

Files #including partcache.h

File Line
0 src/backend/optimizer/path/joinrels.c 24 #include "utils/partcache.h"
1 src/backend/optimizer/prep/prepunion.c 51 #include "utils/partcache.h"
2 src/backend/optimizer/util/relnode.c 30 #include "utils/partcache.h"
3 src/backend/utils/cache/partcache.c 37 #include "utils/partcache.h"
4 src/backend/utils/cache/relcache.c 83 #include "utils/partcache.h"
5 src/include/executor/execPartition.h 19 #include "utils/partcache.h"
6 src/include/utils/rel.h 27 #include "utils/partcache.h"

Thanks,
Amit

Attachment Content-Type Size
v2-0001-Reorganize-partitioning-code.patch text/plain 212.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-02-14 02:26:31 Re: Parameter status message not sent?
Previous Message Tatsuo Ishii 2018-02-14 02:12:30 Parameter status message not sent?