From: Justin Pryzby <pryzby@telsasoft.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Imai, Yoshikazu <imai.yoshikazu@jp.fujitsu.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: speeding up planning with partitions
Date: Thu, 3 Jan 2019 09:39:00 -0600
Message-ID: <20190103153900.GA6236@telsasoft.com> (raw)
In-Reply-To: <55bd88c6-f311-2791-0a36-11c693c69753@lab.ntt.co.jp>
References: <3be67028-a00a-502c-199a-da00eec8fb6e@lab.ntt.co.jp>
<CAKJS1f8g9_BzE678BLBm-eoMMEYUUXhDABSpqtAHRUUTrm_vFA@mail.gmail.com>
<a22f24d1-5e20-f352-f402-3101cb1213bd@lab.ntt.co.jp>
<73596f90-023c-c358-be9a-3c21bffcb15d@lab.ntt.co.jp>
<0F97FA9ABBDBE54F91744A9B37151A5122E7B1@g01jpexmbkw24>
<08a6775f-7c88-81a8-8c2c-984d171b6db9@lab.ntt.co.jp>
<0F97FA9ABBDBE54F91744A9B37151A51232FF7@g01jpexmbkw24>
<0F97FA9ABBDBE54F91744A9B37151A5124C0A0@g01jpexmbkw24>
<580ddb99-cd31-096d-d485-fc309d274498@lab.ntt.co.jp>
<55bd88c6-f311-2791-0a36-11c693c69753@lab.ntt.co.jp>
Hi,
I don't think I can't help with code review, but I loaded our largest
customer's schema into pg12dev and tested with this patch. It's working well -
thanks for your work.
Details follow.
We have tooo many tables+indices so this vastly improves planning speed. Our
large customers have ~300 parent tables and total ~20k child tables with total
~80k indices. Our largest tables heirarchies have ~1200 child tables, which
may have as many as 6-8 indices each. And 5-10 of the largest heirarchies are
unioned together in a view.
Running pg11.1, explaining query for the largest view with condition eliminates
all but today's tables can take several minutes with a cold cache, due to not
only stat()ing every file in every table in a partition heirarchy, before
pruning, but also actually open()ing all their indices.
Running 11dev with your v10 patch applied, this takes 2244ms with empty buffer
cache after postmaster restarted on a totally untuned instance (and a new
backend, with no cached opened files).
I was curious why it took even 2sec, and why it did so many opens() (but not
20k of them that PG11 does):
[pryzbyj@database postgresql]$ cut -d'(' -f1 /tmp/strace-12dev-explain |sort |uniq -c |sort -nr
2544 lseek
1263 open
...
It turns out 1050 open()s are due to historic data which is no longer being
loaded and therefor never converted to relkind=p (but hasn't exceeded the
retention interval so not yet DROPped, either).
Cheers,
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, Langote_Amit_f8@lab.ntt.co.jp, imai.yoshikazu@jp.fujitsu.com, david.rowley@2ndquadrant.com, alvherre@2ndquadrant.com
Subject: Re: speeding up planning with partitions
In-Reply-To: <20190103153900.GA6236@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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