pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Improve performance of find_all_inheritors()
4+ messages / 3 participants
[nested] [flat]

* pgsql: Improve performance of find_all_inheritors()
@ 2017-03-27 16:08 Teodor Sigaev <teodor@sigaev.ru>
  2017-03-27 16:19 ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Teodor Sigaev @ 2017-03-27 16:08 UTC (permalink / raw)
  To: pgsql-committers

Improve performance of find_all_inheritors()

Previous coding uses three nested loops which obviously were a pain for
large number of table's children. Patch replaces inner loop with
a hashmap.

Author: Aleksander Alekseev
Reviewed-by: me

https://commitfest.postgresql.org/13/1058/

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/827d6f977940952ebef4bd21fb0f97be4e20c0c4

Modified Files
--------------
src/backend/catalog/pg_inherits.c | 58 +++++++++++++++++++++++++++++----------
1 file changed, 44 insertions(+), 14 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors()
  2017-03-27 16:08 pgsql: Improve performance of find_all_inheritors() Teodor Sigaev <teodor@sigaev.ru>
@ 2017-03-27 16:19 ` Robert Haas <robertmhaas@gmail.com>
  2017-03-28 19:59   ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Aleksander Alekseev <a.alekseev@postgrespro.ru>
  0 siblings, 1 reply; 4+ messages in thread

From: Robert Haas @ 2017-03-27 16:19 UTC (permalink / raw)
  To: Teodor Sigaev <teodor@sigaev.ru>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Mon, Mar 27, 2017 at 12:08 PM, Teodor Sigaev <teodor@sigaev.ru> wrote:
> Improve performance of find_all_inheritors()
>
> Previous coding uses three nested loops which obviously were a pain for
> large number of table's children. Patch replaces inner loop with
> a hashmap.
>
> Author: Aleksander Alekseev
> Reviewed-by: me
>
> https://commitfest.postgresql.org/13/1058/

I'm a little worried that this will be noticeably slower when the
number of partitions is small, like 4 or 8 or 16.  In other places,
we've found it necessary to support both a list-based strategy and a
hash-based strategy to avoid regressing small cases (e.g.
join_rel_list + join_rel_hash in PlannerInfo, ResourceArray in
resowner.c, etc).

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors()
  2017-03-27 16:08 pgsql: Improve performance of find_all_inheritors() Teodor Sigaev <teodor@sigaev.ru>
  2017-03-27 16:19 ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Robert Haas <robertmhaas@gmail.com>
@ 2017-03-28 19:59   ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-29 00:59     ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Aleksander Alekseev @ 2017-03-28 19:59 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Teodor Sigaev <teodor@sigaev.ru>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Hi, Robert.

> I'm a little worried that this will be noticeably slower when the
> number of partitions is small, like 4 or 8 or 16.  In other places,
> we've found it necessary to support both a list-based strategy and a
> hash-based strategy to avoid regressing small cases (e.g.
> join_rel_list + join_rel_hash in PlannerInfo, ResourceArray in
> resowner.c, etc).

I've checked it [1]. Apparently in this particular case patches make code
faster on small amount of partitions as well. 

[1] https://postgr.es/m/20170324132258.GB16830%40e733.localdomain

-- 
Best regards,
Aleksander Alekseev

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors()
  2017-03-27 16:08 pgsql: Improve performance of find_all_inheritors() Teodor Sigaev <teodor@sigaev.ru>
  2017-03-27 16:19 ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Robert Haas <robertmhaas@gmail.com>
  2017-03-28 19:59   ` Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors() Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-03-29 00:59     ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2017-03-29 00:59 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: Teodor Sigaev <teodor@sigaev.ru>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Tue, Mar 28, 2017 at 3:59 PM, Aleksander Alekseev
<a.alekseev@postgrespro.ru> wrote:
> Hi, Robert.
>
>> I'm a little worried that this will be noticeably slower when the
>> number of partitions is small, like 4 or 8 or 16.  In other places,
>> we've found it necessary to support both a list-based strategy and a
>> hash-based strategy to avoid regressing small cases (e.g.
>> join_rel_list + join_rel_hash in PlannerInfo, ResourceArray in
>> resowner.c, etc).
>
> I've checked it [1]. Apparently in this particular case patches make code
> faster on small amount of partitions as well.

Huh.  Well, in that case, cool.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2017-03-29 00:59 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 16:08 pgsql: Improve performance of find_all_inheritors() Teodor Sigaev <teodor@sigaev.ru>
2017-03-27 16:19 ` Robert Haas <robertmhaas@gmail.com>
2017-03-28 19:59   ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-03-29 00:59     ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox