1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PostgreSQLでパーティション一覧を取得

Last updated at Posted at 2024-07-09

ググっても出てこないので、備忘録

取得

SELECT c.relname AS partition_name,
       i.inhparent AS parent_table
FROM pg_inherits i
JOIN pg_class c ON i.inhrelid = c.oid
WHERE i.inhparent = (SELECT oid FROM pg_class WHERE relname = '親テーブル名');

パーティションを作成したい時

範囲パーティションテーブルのパーティションを作成します。

image.png

CREATE TABLE [実装対象のテーブル名]_[パーティションキー名]
	PARTITION OF [実装対象のテーブル名]
FOR VALUES IN ('[パーティションキー名]');

類似記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?