hive-partitioning

그래서 하이브 파티셔닝이 뭔데?
BigQuery external 테이블 생성 시 hive partitioning 에 대해 고민했었고 정리할 필요가 있어 여러 곳에서 하이브 파티셔닝에 대해 정리한 내용을 가져왔다.

Partitions: Each Table can have one or more partition Keys which determines how the data is stored. Partitions—apart from being storage units—also allow the user to efficiently identify the rows that satisfy a specified criteria; for example, a date_partition of type STRING and country_partition of type STRING. Each unique value of the partition keys defines a partition of the Table. For example, all "US" data from "2009-12-23" is a partition of the page_views table. Therefore, if you run analysis on only the "US" data for 2009-12-23, you can run that query only on the relevant partition of the table, thereby speeding up the analysis significantly. Note however, that just because a partition is named 2009-12-23 does not mean that it contains all or only data from that date; partitions are named after dates for convenience; it is the user's job to guarantee the relationship between partition name and data content! Partition columns are virtual columns, they are not part of the data itself but are derived on load.

orders
├── year=2021
│    ├── month=1
│    │   ├── file1.parquet
│    │   └── file2.parquet
│    └── month=2
│        └── file3.parquet
└── year=2022
   ├── month=11
   │   ├── file4.parquet
   │   └── file5.parquet
   └── month=12
       └── file6.parquet

references