From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Beena Emerson <memissemerson(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] path toward faster partition pruning |
Date: | 2017-12-19 05:42:58 |
Message-ID: | CAKJS1f-GBvMq8v2m=Xp3+w1QiiWg1fJwHYMXGmP7u--0PS-aXw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12 December 2017 at 22:13, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Attached updated patches.
Hi Amit,
I was also wondering about your thoughts on the design of
get_partitions_for_keys() and more generally how there are many
functions which have some special treatment doing something based on
->strategy == PARTITION_STRATEGY_XXX.
If I do:
git grep PARTITION_STRATEGY -- src/backend/catalog/partition.c | wc -l
I get 62 matches, most of which are case statements, and most of the
remainder are things like if (key->strategy ==
PARTITION_STRATEGY_HASH).
git grep --show-function PARTITION_STRATEGY -- src/backend/catalog/partition.c
shows that get_partitions_for_keys() is probably the most guilty of
having the most strategy condition tests.
Also, if we look at get_partitions_for_keys() there's an unconditional:
memset(hash_isnull, false, sizeof(hash_isnull));
which is only used for PARTITION_STRATEGY_HASH, but LIST and RANGE
must pay the price of that memset. Perhaps it's not expensive enough
to warrant only doing that when partkey->strategy ==
PARTITION_STRATEGY_HASH, but it does make me question if we should
have 3 separate functions for this and just have a case statement to
call the correct one.
I think if we were to put this off as something we'll fix later, then
the job would just become harder and harder as time goes on.
It might have been fine when we just had RANGE and LIST partitioning,
but I think HASH really tips the scales over to this being needed.
What do you think?
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Regina Obe | 2017-12-19 08:24:56 | MemoryContextCreate change in PG 11 how should contexts be created |
Previous Message | leoaaryan | 2017-12-19 05:38:43 | Re: Statically linking ICU with Postgres |