pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHow Many Partitions are Good Performing
9+ messages / 6 participants
[nested] [flat]
* How Many Partitions are Good Performing
@ 2018-01-08 23:20 Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Re: How Many Partitions are Good Performing Rakesh Kumar <rakeshkumar464@mail.com>
2018-01-10 17:06 ` Re: How Many Partitions are Good Performing pinker <pinker@onet.eu>
0 siblings, 2 replies; 9+ messages in thread
From: Kumar, Virendra @ 2018-01-08 23:20 UTC (permalink / raw)
To: pgsql-general
Can somebody tell us how many partitions are good number without impacting the performance. We are hearing around a thousand, is that a limit. Do we have plan to increase the number of partitions for a table. We would appreciate if somebody can help us with this?
Regards,
Virendra
________________________________
This message is intended only for the use of the addressee and may contain
information that is PRIVILEGED AND CONFIDENTIAL.
If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify the sender immediately. Thank you.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
@ 2018-01-08 23:54 ` Rakesh Kumar <rakeshkumar464@mail.com>
2018-01-09 00:51 ` Re: How Many Partitions are Good Performing Michael Paquier <michael.paquier@gmail.com>
2018-01-09 17:15 ` Re: How Many Partitions are Good Performing Andrew Staller <andrew@timescale.com>
1 sibling, 2 replies; 9+ messages in thread
From: Rakesh Kumar @ 2018-01-08 23:54 UTC (permalink / raw)
To: Kumar, Virendra <Virendra.Kumar@guycarp.com>; +Cc: pgsql-general
You should have read carefully what I wrote. 1000 is not an upper limit. 1000 partition is the number after which performance starts dropping .
There is a blog in www.timescale.com which also highlights the same.
Sent: Monday, January 08, 2018 at 6:20 PM
From: "Kumar, Virendra" <Virendra.Kumar@guycarp.com>
To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Subject: How Many Partitions are Good Performing
Can somebody tell us how many partitions are good number without impacting the performance. We are hearing around a thousand, is that a limit. Do we have plan to increase the number of partitions for a table. We would appreciate if somebody can help us with this?
Regards,
Virendra
------------------------------------------------------------
This message is intended only for the use of the addressee and may contain
information that is PRIVILEGED AND CONFIDENTIAL.
If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify the sender immediately. Thank you.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Re: How Many Partitions are Good Performing Rakesh Kumar <rakeshkumar464@mail.com>
@ 2018-01-09 00:51 ` Michael Paquier <michael.paquier@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Michael Paquier @ 2018-01-09 00:51 UTC (permalink / raw)
To: Rakesh Kumar <rakeshkumar464@mail.com>; +Cc: Kumar, Virendra <Virendra.Kumar@guycarp.com>; pgsql-general
On Tue, Jan 09, 2018 at 12:54:18AM +0100, Rakesh Kumar wrote:
> Can somebody tell us how many partitions are good number without
> impacting the performance. We are hearing around a thousand, is that a
> limit. Do we have plan to increase the number of partitions for a
> table. We would appreciate if somebody can help us with this?
What matters here is that the bottleneck comes from the planner which
uses basically a O(N^2) algorithm to evaluate all the partitions, so a
too high number causes planning time to increase dramatically. In
Postgres 11, things get improved with more partition-wise logics.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Re: How Many Partitions are Good Performing Rakesh Kumar <rakeshkumar464@mail.com>
@ 2018-01-09 17:15 ` Andrew Staller <andrew@timescale.com>
2018-01-09 17:21 ` RE: How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-09 17:25 ` Re: How Many Partitions are Good Performing Vincenzo Romano <vincenzo.romano@notorand.it>
1 sibling, 2 replies; 9+ messages in thread
From: Andrew Staller @ 2018-01-09 17:15 UTC (permalink / raw)
To: Rakesh Kumar <rakeshkumar464@mail.com>; +Cc: Kumar, Virendra <Virendra.Kumar@guycarp.com>; pgsql-general
This is the blog post that Rakesh referenced:
https://blog.timescale.com/time-series-data-postgresql-10-vs-timescaledb-816ee808bac5
Please note, this analysis is done in the context of working with
time-series data, where 1000s of chunks is not uncommon because of the
append-mostly nature of the workload.
On Mon, Jan 8, 2018 at 6:54 PM, Rakesh Kumar <rakeshkumar464@mail.com>
wrote:
>
> You should have read carefully what I wrote. 1000 is not an upper
> limit. 1000 partition is the number after which performance starts
> dropping .
>
> There is a blog in www.timescale.com which also highlights the same.
>
> Sent: Monday, January 08, 2018 at 6:20 PM
> From: "Kumar, Virendra" <Virendra.Kumar@guycarp.com>
> To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
> Subject: How Many Partitions are Good Performing
>
> Can somebody tell us how many partitions are good number without impacting
> the performance. We are hearing around a thousand, is that a limit. Do we
> have plan to increase the number of partitions for a table. We would
> appreciate if somebody can help us with this?
>
> Regards,
> Virendra
>
>
> ------------------------------------------------------------
> This message is intended only for the use of the addressee and may contain
> information that is PRIVILEGED AND CONFIDENTIAL.
>
> If you are not the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please erase all copies of the
> message
> and its attachments and notify the sender immediately. Thank you.
>
>
--
TimescaleDB* | *Growth & Developer Evangelism
c: 908.581.9509
335 Madison Ave.
New York, NY 10017
http://www.timescale.com/
https://github.com/timescale/timescaledb
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Re: How Many Partitions are Good Performing Rakesh Kumar <rakeshkumar464@mail.com>
2018-01-09 17:15 ` Re: How Many Partitions are Good Performing Andrew Staller <andrew@timescale.com>
@ 2018-01-09 17:21 ` Kumar, Virendra <Virendra.Kumar@guycarp.com>
1 sibling, 0 replies; 9+ messages in thread
From: Kumar, Virendra @ 2018-01-09 17:21 UTC (permalink / raw)
To: Andrew Staller <andrew@timescale.com>; Rakesh Kumar <rakeshkumar464@mail.com>; +Cc: pgsql-general
Thank you Rakesh and Andrew!
We will not be doing time scaling but we have list of value based of which we will be partitioning the table and list is something around 7500 now.
For short term we are thinking of putting around a thousand partitions and when PG11 releases we will go for each value a partition.
Regards,
Virendra
From: Andrew Staller [mailto:andrew@timescale.com]
Sent: Tuesday, January 09, 2018 12:15 PM
To: Rakesh Kumar
Cc: Kumar, Virendra; pgsql-general@postgresql.org
Subject: Re: How Many Partitions are Good Performing
This is the blog post that Rakesh referenced:
https://blog.timescale.com/time-series-data-postgresql-10-vs-timescaledb-816ee808bac5
Please note, this analysis is done in the context of working with time-series data, where 1000s of chunks is not uncommon because of the append-mostly nature of the workload.
On Mon, Jan 8, 2018 at 6:54 PM, Rakesh Kumar <rakeshkumar464@mail.com<mailto:rakeshkumar464@mail.com>> wrote:
You should have read carefully what I wrote. 1000 is not an upper limit. 1000 partition is the number after which performance starts dropping .
There is a blog in www.timescale.com<http://www.timescale.com; which also highlights the same.
Sent: Monday, January 08, 2018 at 6:20 PM
From: "Kumar, Virendra" <Virendra.Kumar@guycarp.com<mailto:Virendra.Kumar@guycarp.com>>
To: "pgsql-general@postgresql.org<mailto:pgsql-general@postgresql.org>" <pgsql-general@postgresql.org<mailto:pgsql-general@postgresql.org>>
Subject: How Many Partitions are Good Performing
Can somebody tell us how many partitions are good number without impacting the performance. We are hearing around a thousand, is that a limit. Do we have plan to increase the number of partitions for a table. We would appreciate if somebody can help us with this?
Regards,
Virendra
------------------------------------------------------------
This message is intended only for the use of the addressee and may contain
information that is PRIVILEGED AND CONFIDENTIAL.
If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify the sender immediately. Thank you.
--
TimescaleDB | Growth & Developer Evangelism
c: 908.581.9509
335 Madison Ave.
New York, NY 10017
http://www.timescale.com/
https://github.com/timescale/timescaledb
________________________________
This message is intended only for the use of the addressee and may contain
information that is PRIVILEGED AND CONFIDENTIAL.
If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify the sender immediately. Thank you.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Re: How Many Partitions are Good Performing Rakesh Kumar <rakeshkumar464@mail.com>
2018-01-09 17:15 ` Re: How Many Partitions are Good Performing Andrew Staller <andrew@timescale.com>
@ 2018-01-09 17:25 ` Vincenzo Romano <vincenzo.romano@notorand.it>
1 sibling, 0 replies; 9+ messages in thread
From: Vincenzo Romano @ 2018-01-09 17:25 UTC (permalink / raw)
To: Andrew Staller <andrew@timescale.com>; +Cc: Rakesh Kumar <rakeshkumar464@mail.com>; Kumar, Virendra <Virendra.Kumar@guycarp.com>; pgsql-general
2018-01-09 18:15 GMT+01:00 Andrew Staller <andrew@timescale.com>:
> This is the blog post that Rakesh referenced:
> https://blog.timescale.com/time-series-data-postgresql-
> 10-vs-timescaledb-816ee808bac5
>
> Please note, this analysis is done in the context of working with
> time-series data, where 1000s of chunks is not uncommon because of the
> append-mostly nature of the workload.
>
> On Mon, Jan 8, 2018 at 6:54 PM, Rakesh Kumar <rakeshkumar464@mail.com>
> wrote:
>
>>
>> You should have read carefully what I wrote. 1000 is not an upper
>> limit. 1000 partition is the number after which performance starts
>> dropping .
>>
>> There is a blog in www.timescale.com which also highlights the same.
>>
>> Sent: Monday, January 08, 2018 at 6:20 PM
>> From: "Kumar, Virendra" <Virendra.Kumar@guycarp.com>
>> To: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
>> Subject: How Many Partitions are Good Performing
>>
>> Can somebody tell us how many partitions are good number without
>> impacting the performance. We are hearing around a thousand, is that a
>> limit. Do we have plan to increase the number of partitions for a table. We
>> would appreciate if somebody can help us with this?
>>
>> Regards,
>> Virendra
>>
>>
>> ------------------------------------------------------------
>> This message is intended only for the use of the addressee and may contain
>> information that is PRIVILEGED AND CONFIDENTIAL.
>>
>> If you are not the intended recipient, you are hereby notified that any
>> dissemination of this communication is strictly prohibited. If you have
>> received this communication in error, please erase all copies of the
>> message
>> and its attachments and notify the sender immediately. Thank you.
>>
>>
>
>
> --
> TimescaleDB* | *Growth & Developer Evangelism
> c: 908.581.9509
>
> 335 Madison Ave.
> <https://maps.google.com/?q=335+Madison+Ave.%C2%A0New+York,+NY%C2%A010017&entry=gmail&source=...;
> New York, NY 10017
> <https://maps.google.com/?q=335+Madison+Ave.%C2%A0New+York,+NY%C2%A010017&entry=gmail&source=...;
> http://www.timescale.com/
> https://github.com/timescale/timescaledb
>
The data about the query performances would have shed more light on the
situation.
Unluckily there's none. Weird!
--
Vincenzo Romano - NotOrAnd.IT
Information Technologies
--
NON QVIETIS MARIBVS NAVTA PERITVS
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
@ 2018-01-10 17:06 ` pinker <pinker@onet.eu>
2018-01-10 22:33 ` RE: How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
1 sibling, 1 reply; 9+ messages in thread
From: pinker @ 2018-01-10 17:06 UTC (permalink / raw)
To: pgsql-general
I've run once a test on my laptop because was curious as well. From my
results (on laptop - 16GB RAM, 4 cores) the upper limit was 12k. Above it
planning time was unbearable high - much higher than execution time. It's
been tested on 9.5
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-10 17:06 ` Re: How Many Partitions are Good Performing pinker <pinker@onet.eu>
@ 2018-01-10 22:33 ` Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-11 09:15 ` RE: How Many Partitions are Good Performing pinker <pinker@onet.eu>
0 siblings, 1 reply; 9+ messages in thread
From: Kumar, Virendra @ 2018-01-10 22:33 UTC (permalink / raw)
To: pinker <pinker@onet.eu>; +Cc: pgsql-general
For test I created two tables with 7800 partitions each and joining them sees performance bottleneck. It is taking 5 seconds planning time. Please see attached plan.
Regards,
Virendra
-----Original Message-----
From: pinker [mailto:pinker@onet.eu]
Sent: Wednesday, January 10, 2018 12:07 PM
To: pgsql-general@postgresql.org
Subject: Re: How Many Partitions are Good Performing
I've run once a test on my laptop because was curious as well. From my results (on laptop - 16GB RAM, 4 cores) the upper limit was 12k. Above it planning time was unbearable high - much higher than execution time. It's been tested on 9.5
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
________________________________
This message is intended only for the use of the addressee and may contain
information that is PRIVILEGED AND CONFIDENTIAL.
If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify the sender immediately. Thank you.
Attachments:
output.txt (text/plain, 6.1K) download
Aggregate (cost=337270.14..337270.15 rows=1 width=232) (actual time=102.123..102.124 rows=1 loops=1)
Buffers: shared hit=22747
CTE t1
-> HashAggregate (cost=2773.81..2795.37 rows=2156 width=24) (actual time=12.051..13.626 rows=2792 loops=1)
Group Key: se_1.site_id, se_1.peril_id, se_1.account_id, se_1.portfolio_id
Buffers: shared hit=385
-> Nested Loop (cost=10.05..2752.25 rows=2156 width=24) (actual time=0.359..9.940 rows=2792 loops=1)
Buffers: shared hit=385
-> Seq Scan on catevent_earthquake_poly_merged (cost=0.00..17.75 rows=3 width=32) (actual time=0.027..0.030 rows=1 loops=1)
Filter: (event_id = 'us20009yvq'::text)
Rows Removed by Filter: 3
Buffers: shared hit=2
-> Append (cost=10.05..910.78 rows=72 width=56) (actual time=0.328..7.250 rows=2792 loops=1)
Buffers: shared hit=383
-> Bitmap Heap Scan on site_exposure_13397 se_1 (cost=10.05..910.78 rows=72 width=56) (actual time=0.325..4.726 rows=2792 loops=1)
Recheck Cond: (shape && catevent_earthquake_poly_merged.shape)
Filter: ((portfolio_id = 13397) AND _st_intersects(shape, catevent_earthquake_poly_merged.shape))
Heap Blocks: exact=360
Buffers: shared hit=383
-> Bitmap Index Scan on site_exposure_13397_shape_idx (cost=0.00..10.03 rows=216 width=0) (actual time=0.263..0.263 rows=2792 loops=1)
Index Cond: (shape && catevent_earthquake_poly_merged.shape)
Buffers: shared hit=23
-> Hash Join (cost=271937.09..334470.48 rows=59 width=200) (actual time=88.676..98.896 rows=2792 loops=1)
Hash Cond: ((se.peril_id = p.pe_peril_id) AND (se.account_id = p.pe_account_id))
Buffers: shared hit=22747
-> GroupAggregate (cost=271794.39..330553.67 rows=215630 width=152) (actual time=30.641..37.303 rows=2792 loops=1)
Group Key: se.peril_id, se.portfolio_id, se.account_id
Buffers: shared hit=11178
-> Sort (cost=271794.39..274489.77 rows=1078152 width=148) (actual time=30.629..32.018 rows=2792 loops=1)
Sort Key: se.peril_id, se.account_id
Sort Method: quicksort Memory: 838kB
Buffers: shared hit=11178
-> Nested Loop (cost=48.94..1614.87 rows=1078152 width=148) (actual time=3.305..27.195 rows=2792 loops=1)
Buffers: shared hit=11178
-> HashAggregate (cost=48.51..50.51 rows=200 width=8) (actual time=3.274..4.957 rows=2792 loops=1)
Group Key: t1.site_id
-> CTE Scan on t1 (cost=0.00..43.12 rows=2156 width=8) (actual time=0.002..1.378 rows=2792 loops=1)
-> Append (cost=0.43..7.81 rows=1 width=156) (actual time=0.004..0.006 rows=1 loops=2792)
Buffers: shared hit=11178
-> Index Scan using site_exposure_13397_pkey on site_exposure_13397 se (cost=0.43..7.81 rows=1 width=156) (actual time=0.003..0.004 rows=1 loops=2792)
Index Cond: (site_id = t1.site_id)
Filter: (portfolio_id = 13397)
Buffers: shared hit=11178
-> Hash (cost=142.53..142.53 rows=11 width=80) (actual time=58.016..58.016 rows=2792 loops=1)
Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 349kB
Buffers: shared hit=11569
-> Subquery Scan on p (cost=141.98..142.53 rows=11 width=80) (actual time=48.018..56.051 rows=2792 loops=1)
Buffers: shared hit=11569
-> GroupAggregate (cost=141.98..142.42 rows=11 width=80) (actual time=48.016..53.268 rows=2792 loops=1)
Group Key: pe.peril_id, pe.portfolio_id, pe.account_id
Buffers: shared hit=11569
-> Sort (cost=141.98..142.01 rows=11 width=80) (actual time=48.002..49.286 rows=2792 loops=1)
Sort Key: pe.peril_id, pe.account_id
Sort Method: quicksort Memory: 489kB
Buffers: shared hit=11569
-> Nested Loop (cost=49.02..141.79 rows=11 width=80) (actual time=18.957..45.059 rows=2792 loops=1)
Buffers: shared hit=11569
-> HashAggregate (cost=48.59..48.70 rows=11 width=16) (actual time=18.922..20.890 rows=2792 loops=1)
Group Key: t2.peril_id, t2.account_id, t2.portfolio_id
Buffers: shared hit=385
-> CTE Scan on t1 t2 (cost=0.00..48.51 rows=11 width=16) (actual time=12.055..16.855 rows=2792 loops=1)
Filter: (portfolio_id = 13397)
Buffers: shared hit=385
-> Append (cost=0.43..8.45 rows=1 width=80) (actual time=0.005..0.007 rows=1 loops=2792)
Buffers: shared hit=11184
-> Index Scan using policy_exposure_13397_portfolio_id_peril_id_account_id_idx on policy_exposure_13397 pe (cost=0.43..8.45 rows=1 width=80) (actual time=0.004..0.005 rows=1 loops=2792)
Index Cond: ((portfolio_id = 13397) AND (peril_id = t2.peril_id) AND (account_id = t2.account_id))
Buffers: shared hit=11184
Planning time: 5225.920 ms
Execution time: 104.319 ms
(70 rows)
Time: 6705.007 ms (00:06.705)
^ permalink raw reply [nested|flat] 9+ messages in thread
* RE: How Many Partitions are Good Performing
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-10 17:06 ` Re: How Many Partitions are Good Performing pinker <pinker@onet.eu>
2018-01-10 22:33 ` RE: How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
@ 2018-01-11 09:15 ` pinker <pinker@onet.eu>
0 siblings, 0 replies; 9+ messages in thread
From: pinker @ 2018-01-11 09:15 UTC (permalink / raw)
To: pgsql-general
yes, it doesn't look good. and it seems that statistics aren't accurate:
GroupAggregate (cost=271794.39..330553.67 rows=215630 width=152) (actual
time=30.641..37.303 rows=2792 loops=1)
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2018-01-11 09:15 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-08 23:20 How Many Partitions are Good Performing Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-08 23:54 ` Rakesh Kumar <rakeshkumar464@mail.com>
2018-01-09 00:51 ` Michael Paquier <michael.paquier@gmail.com>
2018-01-09 17:15 ` Andrew Staller <andrew@timescale.com>
2018-01-09 17:21 ` Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-09 17:25 ` Vincenzo Romano <vincenzo.romano@notorand.it>
2018-01-10 17:06 ` pinker <pinker@onet.eu>
2018-01-10 22:33 ` Kumar, Virendra <Virendra.Kumar@guycarp.com>
2018-01-11 09:15 ` pinker <pinker@onet.eu>
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