开发者社区> 问答> 正文

What are partitioned tables called in PostgreSQL?

已解决

What are partitioned tables called in PostgreSQL?

展开
收起
1780169608831412 2021-10-16 15:03:59 479 0
1 条回答
写回答
取消 提交回答
  • 网络规划设计师、敏捷专家、CISP、ITSS服务经理、ACA全科目、ACP4项、ACE、CBP、CDSP、CZTP等。拥有 PRINCE2 Foundation/Practitioner、CCSK、ITIL、ISO27001、PMP等多项国际认证。 专利5+、期刊10+、知识产权师。核心期刊审稿人。
    采纳回答

    Partitioned tables are logical structures that are used for dividing large tables into smaller structures that are called partitions. This approach is used for effectively increasing the query performance while dealing with large database tables. To create a partition, a key called partition key which is usually a table column or an expression, and a partitioning method needs to be defined.

    There are three types of inbuilt partitioning methods provided by Postgres:

    Range Partitioning: This method is done by partitioning based on a range of values. This method is most commonly used upon date fields to get monthly, weekly or yearly data. In the case of corner cases like value belonging to the end of the range, for example: if the range of partition 1 is 10-20 and the range of partition 2 is 20-30, and the given value is 10, then 10 belongs to the second partition and not the first.

    List Partitioning: This method is used to partition based on a list of known values. Most commonly used when we have a key with a categorical value. For example, getting sales data based on regions divided as countries, cities, or states.

    Hash Partitioning: This method utilizes a hash function upon the partition key. This is done when there are no specific requirements for data division and is used to access data individually. For example, you want to access data based on a specific product, then using hash partition would result in the dataset that we require.

    The type of partition key and the type of method used for partitioning determines how positive the performance and the level of manageability of the partitioned table are.

    2021-10-16 16:27:02
    赞同 1 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
阿里云PostgreSQL、PPAS、HDB for PG生 立即下载
Oracle 至PostgreSQL案例分享 立即下载
PostgresChina2018_王帅_从Oracle到PostgreSQL的数据迁移 立即下载

相关镜像