46
Copyright©2018 NTT Corp. All Rights Reserved. HypoPG2: Hypothetical Partitioning support for PostgreSQL PGConf.ASIA 2018 12th of December Yuzuko Hosoya (*1) , Julien Rouhaud (*2) *1: NTT OSS Center, *2: LzLabs

HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

  • Upload
    others

  • View
    40

  • Download
    0

Embed Size (px)

Citation preview

Page 1: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

Copyright©2018 NTT Corp. All Rights Reserved.

HypoPG2: Hypothetical Partitioning

support for PostgreSQL

PGConf.ASIA 201812th of December

Yuzuko Hosoya(*1), Julien Rouhaud(*2)

*1: NTT OSS Center, *2: LzLabs

Page 2: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

2Copyright©2018 NTT Corp. All Rights Reserved.

Who are We ?

•Yuzuko Hosoya (From Tokyo, Japan)

⁃NTT Open Source Software Center

⁃Working on HypoPG

⁃ Interested in Partitioning/Planner

•Julien Rouhaud (From Paris, France)

⁃Lzlabs

⁃Working on HypoPG, POWA

Page 3: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

3Copyright©2018 NTT Corp. All Rights Reserved.

I. Introduction of HypoPG

II. Why Hypothetical Partitioning?

III. Usage & Architecture of Hypothetical Partitioning

IV. Demo

V. Future Works

VI. Summary

Agenda

Page 4: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

4Copyright©2018 NTT Corp. All Rights Reserved.

Introduction of HypoPG

Page 5: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

5Copyright©2018 NTT Corp. All Rights Reserved.

Introduction of HypoPG

Released by Julien Rouhaud

Latest version HypoPG 1.1.2

Support PostgreSQL 9.2 and above

Github https://github.com/HypoPG/hypopg

Documentation https://hypopg.readthedocs.io

Page 6: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

6Copyright©2018 NTT Corp. All Rights Reserved.

• Supports hypothetical Indexes

• Allows users to define hypothetical indexes on real tables

and data

• If hypothetical indexes are defined on a table, planner

considers them along with any real indexes

•Outputs queries’ plan/cost with EXPLAIN as if hypothetical

indexes actually existed

•Helps index design tuning

HypoPG 1.X

Page 7: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

7Copyright©2018 NTT Corp. All Rights Reserved.

HypoPG 2 (beta is now available!)

•Multiple months of work!

• Supports hypothetical partitioning (PostgreSQL 10 and above)

• Allows users to try/simulate different hypothetical partitioning

schemes on real tables and data

•Outputs queries’ plan/cost with EXPLAIN using hypothetical

partitioning schemes

•Helps partitioning design tuning

Page 8: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

8Copyright©2018 NTT Corp. All Rights Reserved.

Why Hypothetical Partitioning?

Page 9: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

9Copyright©2018 NTT Corp. All Rights Reserved.

• Declarative Partitioning was introduced in PostgreSQL 10

• Improved in all new versions

PostgreSQL Partitioning

v10 v11v9.6 v12

Partitioning by combination

of following features⁃ Table Inheritance

⁃ Check Constraint

⁃ Trigger

Declarative Partitioning was introduced⁃ Partitioning enabled by

CREATE TABLE statement

⁃ RANGE/LIST Partitioning

Many enhancements of partitioning⁃ HASH Partitioning

⁃ Partitioned Index

⁃ Default Partition

⁃ Faster Partition Pruning

⁃ Partitionwise Join/Aggregation

⁃ Improvement

planning for

partitioning

and so on

Page 10: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

10Copyright©2018 NTT Corp. All Rights Reserved.

• The most IMPORTANT factor affecting query performance over

a partitioned table is partitioning schemes

Which tables to be partitioned

Which strategy to be chosen

Which columns to be specified as a partition key

How many partitions to be created

Query Performance and

Partitioning Schemes

Page 11: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

11Copyright©2018 NTT Corp. All Rights Reserved.

•Do not scan unnecessary partitions to reduce data size to be read

from the disk

Partition Pruning

January

December

12 partitions

orders

SELECT * FROM orders WHERE date=‘January’;

Scanned

NOT

Scanned

Page 12: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

12Copyright©2018 NTT Corp. All Rights Reserved.

•Do not scan unnecessary partitions to reduce data size to be read

from the disk

•Optimal partitioning Scheme:

Partition by the column specified in WHERE clause

Partition Pruning

January

December

12 partitions

orders

Partition

by

date

SELECT * FROM orders WHERE date=‘January’;

Page 13: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

13Copyright©2018 NTT Corp. All Rights Reserved.

• Joining pairs of partitions might be faster than joining large tables

Partitionwise Join

SELECT c.name FROM orders o LEFT JOIN customers c ON o.cust_id = c.cust_id where o.date = ‘September’;

orders customers

1-1000

5001-6000

1-1000

5001-6000

Page 14: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

14Copyright©2018 NTT Corp. All Rights Reserved.

• Joining pairs of partitions might be faster than joining large tables

•Optimal partitioning scheme:

Partitioned by the column specified in JOIN clause

Partitionwise Join

SELECT c.name FROM orders o LEFT JOIN customers c ON o.cust_id = c.cust_id where o.date = ‘September’;

orders customers

1-1000

5001-6000

1-1000

5001-6000Partition

by

cust_id

Partition

by

cust_id

Page 15: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

15Copyright©2018 NTT Corp. All Rights Reserved.

• Performing aggregation per partition and combining them might be

faster than performing aggregation on large table

Partitionwise Aggregation

January

December

orders

SELECT date, sum(price) FROM orders GROUP BY date;

Agg

Agg

Page 16: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

16Copyright©2018 NTT Corp. All Rights Reserved.

• Performing aggregation per partition and combining them might be

faster than performing aggregation on large table

•Optimal partitioning scheme:

Partitioned by the column specified in GROUP BY clause

Partitionwise Aggregation

SELECT date, sum(price) FROM orders GROUP BY date;

January

December

orders

Partition

by

date

Page 17: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

17Copyright©2018 NTT Corp. All Rights Reserved.

•Assume this situation

Question:

How do you partition these tables?

orders customers

SELECT * FROM orders WHERE date=‘January’;

SELECT c.name FROM orders o LEFT JOIN customers c ON o.cust_id = c.cust_id where o.date = ‘September’;

Partition

by

cust_id?

Partition

by

date?

Partition

by

order_id?

Page 18: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

18Copyright©2018 NTT Corp. All Rights Reserved.

• There are often multiple choices on partitioning schemes

•Queries’ plan/cost are largely affected by data size and parameter

settings

It’s VERY HARD …

Page 19: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

19Copyright©2018 NTT Corp. All Rights Reserved.

• There are often multiple choices on partitioning schemes

•Query plan/cost are largely affected by data size and parameter

settings

It’s VERY HARD …

Do you want to know how your queries would

behave before actually partitioning tables?

Page 20: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

20Copyright©2018 NTT Corp. All Rights Reserved.

• You can quickly check how your queries would behave if certain

tables were partitioned without actually partitioning any tables and

wasting any resources or locking anything

• You can try different partitioning schemes in a short time

Hypothetical Partitioning is Helpful!

Page 21: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

21Copyright©2018 NTT Corp. All Rights Reserved.

Usage & Architectureof Hypothetical Partitioning

Page 22: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

22Copyright©2018 NTT Corp. All Rights Reserved.

•Need to have an actual plain table

•Create hypothetical partitioning schemes using following function:

For hypothetical partitioned table

For hypothetical partitions NOTE: the 3rd argument is only for subpartitioning

How to Create

Hypothetical Partitioning Schemes

hypopg_partition_table(‘table_name’, ‘PARTITION BY strategy(column)’)

hypopg_add_partition(‘table_name’, ‘PARTITION OF parent FOR VALUES partition_bound’, ‘PARTITION BY strategy(column)’)

Page 23: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

23Copyright©2018 NTT Corp. All Rights Reserved.

•HASH partitioning (simple example, no subpartition)

For each partition

•get its modulus

• compute the total fraction of the root table that should be in

the given partition

• Example

• CREATE TABLE t1 … FOR VALUES WITH (MODULUS 10, REMAINDER 1)

• CREATE TABLE t2 … FOR VALUES WITH (MODULUS 5, REMINDER 2)

• Partition t1 would have 10% of all rows

• Partition t2 would have 20% of all rows

How to Estimate Cost/Rows

Page 24: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

24Copyright©2018 NTT Corp. All Rights Reserved.

•RANGE/LIST partitioning (simple example, no subpartition)

For each partition

•get the partition’s constraint

• compute the selectivity for those constraints

• Example

• CREATE TABLE t1 … FOR VALUES FROM (1) TO (10)

• the constraints are

id >= 1 AND id < 10

• estimate this predicate using standard PostgreSQL selectivity functions

How to Estimate Cost/Rows

Page 25: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

25Copyright©2018 NTT Corp. All Rights Reserved.

• This approach can lead to very bad estimates in some cases

(list partitioning, subpartitioning, complex partitioning expressions…)

•We added a function to compute accurate statistics according to

the defined partitioning scheme: hypopg_analyze()

•We also store the number of estimated rows in each partition

during the process

•Be careful, this has to be explicitly called! (there’s no autovacuum for hypopg_analyze)

But this has defaults!

Page 26: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

26Copyright©2018 NTT Corp. All Rights Reserved.

•Create hypothetical statistics for hypothetical partitions using

following function:

• The table specified in the first argument of this function must be

a root table

• Statistics of all leaf partitions, which are related to the given table,

are created

How to Create Hypothetical Statistics

hypopg_analyze(‘table_name’, percentage for sampling)

Page 27: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

27Copyright©2018 NTT Corp. All Rights Reserved.

• For each partition, get the partition bounds including its ancestors

if any

How hypopg_analyze() Works

January

December

orders February

1-1000

1000-2000

partition bound:

date = ‘January’ ,

cust_id >= 1 AND

cust_id < 1000

hypopg_analyze(‘orders’, 70);

partition

by date

partition

by cust_id

Page 28: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

28Copyright©2018 NTT Corp. All Rights Reserved.

• For each partition, get the partition bounds including its ancestors

if any

•Generate a WHERE clause according to the partition bound

How hypopg_analyze() Works

January

December

orders February

1-1000

1000-2000

partition bound:

date = ‘January’ and

cust_id >= 1 and

cust_id < 1000

WHEREdate = ‘January’ ANDcust_id >= 1 ANDcust_id < 1000

hypopg_analyze(‘orders’, 70);

partition

by date

partition

by cust_id

Page 29: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

29Copyright©2018 NTT Corp. All Rights Reserved.

• For each partition, get the partition bounds including its ancestors

if any

•Generate a WHERE clause according to the partition bound

•Compute stats for sampling data got by TABLESAMPLE and the

WHERE clause

How hypopg_analyze() Works

partition bound:

date = ‘January’ and

cust_id >= 1 and

cust_id < 1000

WHEREdate = ‘January’ ANDcust_id >= 1 ANDcust_id < 1000

hypopg_analyze(‘orders’, 70);

January

December

orders February

1-1000

1000-2000

partition

by date

partition

by cust_id

Page 30: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

30Copyright©2018 NTT Corp. All Rights Reserved.

Get sampling data from a target table according to percentage

Two kinds of sampling method

⁃SYSTEM: pick data by the page

⁃BERNOULLI: pick data by the row

Specify WHERE clause

eliminate data that doesn’t satisfied WHERE condition

TABLESAMPLE Clause

SELECT select_expression FROM table_nameTABLESAMPLE sampling_method(percentage) WHERE condition

sampling filtering

target

table

Page 31: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

31Copyright©2018 NTT Corp. All Rights Reserved.

• For each partition, get the partition bounds including its ancestors

if any

•Generate a WHERE clause according to the partition bound

•Compute stats for sampling data got by TABLESAMPLE and the

WHERE clause

How hypopg_analyze() Works

partition bound:

date = ‘January’ and

cust_id >= 1 and

cust_id < 1000

WHEREdate = ‘January’ ANDcust_id >= 1 ANDcust_id < 1000

sampling filtering

Compute Stats

orders

hypopg_analyze(‘orders’, 70);

January

December

orders February

1-1000

1000-2000

partition

by date

partition

by cust_id

Page 32: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

32Copyright©2018 NTT Corp. All Rights Reserved.

• hypopg_analyze() won’t retrieve constraints for a hash partition

• instead,

• sum the fractions of rows each level of partition defined with a

hash partitioning scheme

• do a simple ratio of the previously computed values (for all

non-hash partitions)

Exception

RANGE

HASHcomputed by

hypopg_analyze()computed by

modulus

Page 33: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

33Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

HypoPG uses four kinds of hooks

(five kinds of hooks for PostgreSQL 10)

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

Page 34: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

34Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

Using ProcessUtility_hook, HypoPG detects an EXPLAIN

without ANALYZE option and saves it in a local flag for

following steps

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

1

Page 35: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

35Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

Using get_relation_info_hook, hypothetical partitioning

scheme is injected if the target table is partitioned

hypothetically

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

2

Page 36: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

36Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

Using get_relation_stats_hook, hypothetical statistics are

injected to estimate correctly if they were created in advance

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

3

Page 37: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

37Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

(for PostgreSQL 10)

Using set_rel_pathlist_hook, a partition which is need not be

scanned is marked as dummy for partition pruning

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

3’

dummy dummy

Page 38: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

38Copyright©2018 NTT Corp. All Rights Reserved.

Architecture

Using ExecutorEnd_hook, the EXPLAIN flag is removed.

Finally a query plan using hypothetical partitioning schemes

is displayed!!

TT

T1 T3T2stat

stat stat stat

EXPLAIN

Query Plan

PostgreSQL HypoPG

Actual Hypothetical

Table OID

Hypothetical

Scheme/

Statistics

4

Page 39: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

39Copyright©2018 NTT Corp. All Rights Reserved.

DEMO

Page 40: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

40Copyright©2018 NTT Corp. All Rights Reserved.

•Create a hypothetical partitioning scheme and execute some

simple queries

⁃A simple customers table to be partitioned actually:

⁃A simple orders table to be partitioned hypothetically:NOTE: for convenience, this table is named **hypo_**orders to quickly

identify it in the plans.

DEMO time!

customers (cust_id integer PRIMARY KEY,name TEXT, address TEXT)

hypo_orders (orders_id int PRIMARY KEY, cust_id int, price int, date date)

Page 41: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

41Copyright©2018 NTT Corp. All Rights Reserved.

• Simulate RANGE/LIST/HASH Partitioning

• Simulate SELECT queries

Partition Pruning, Partitionwise Join/Aggregation,

N-way Join, Parallel Query

• Simulate INSERT queries

• Simulate multi-level hypothetical partitioning

• Simulate a default partition (which can also be partitioned)

• Simulate indexes on hypothetical partitions

Both actual and hypothetical indexes

What You Can Do

Page 42: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

42Copyright©2018 NTT Corp. All Rights Reserved.

•Only for plain tables, not on already partitioned tables

Inheritance based and declarative partitioning

• Table name can’t be changed in explain, an alias is used

instead to show the hypothetical partition name

•Do not support UPDATE/DELETE queries

•Do not support PostgreSQL 12 yet

Limitations

Page 43: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

43Copyright©2018 NTT Corp. All Rights Reserved.

Future Works & Summary

Page 44: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

44Copyright©2018 NTT Corp. All Rights Reserved.

•Have a better integration in PostgreSQL core to ease our

limitations

- Support UPDATE/DELETE queries

- Support already partitioned tables

• Support PostgreSQL 12 (and future versions)

•Add automated advisor feature

pg_qualstats can help to find columns used in all queries on a

given table if any

What’s next?

Page 45: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

45Copyright©2018 NTT Corp. All Rights Reserved.

HypoPG2 supports hypothetical partitioning

⁃Allows users to try/simulate different hypothetical partitioning

schemes on real tables and data

⁃Outputs queries’ plan/cost with EXPLAIN using hypothetical

partitioning schemes

Hypothetical partitioning helps you all to design

partitioning schemes

⁃You can quickly check how your queries would behave if certain

tables were partitioned without actually partitioning any tables

and wasting any resources

⁃You can try different partitioning schemes in a short time

We’d be happy to have some feedbacks!

Summary

Page 46: HypoPG2: Hypothetical Partitioning support for PostgreSQL · PostgreSQL Partitioning v9.6 v10 v11 v12 Partitioning by combination of following features ⁃ Table Inheritance ⁃ Check

46Copyright©2018 NTT Corp. All Rights Reserved.

THANK YOU!

Yuzuko Hosoya

[email protected]

Julien Rouhaud

[email protected]