Penggunaan
view: view_name {
derived_table: {
cluster_keys: ["customer_city", "customer_state"]
...
}
}
|
Hierarki
cluster_keys- atau - cluster_keys |
Nilai Default
None
Menerima
Satu atau beberapa nama kolom berklaster
Aturan Khusus
cluster_keys hanya didukung di dialek tertentu
|
Definisi
Mengelompokkan tabel yang dipartisi akan mengurutkan data dalam partisi berdasarkan nilai dalam kolom yang dikelompokkan dan mengatur kolom yang dikelompokkan dalam blok penyimpanan berukuran optimal. Pengelompokan dapat meningkatkan performa dan mengurangi biaya kueri yang memfilter atau menggabungkan menurut kolom yang dikelompokkan.
Lihat bagian Dukungan dialek untuk cluster_keys untuk mengetahui daftar dialek yang mendukung cluster_keys.
Untuk menambahkan kolom berklaster ke tabel turunan persisten (PDT) atau tabel gabungan, gunakan parameter cluster_keys dan berikan nama kolom yang ingin Anda kelompokkan dalam tabel database.
Contoh
Buat tabel turunan native customer_order_facts di database BigQuery, yang dipartisi pada kolom date dan dikelompokkan pada kolom city, age_tier, dan gender untuk mengoptimalkan kueri yang difilter atau digabungkan pada kolom tersebut:
view: customer_order_facts {
derived_table: {
explore_source: order {
column: customer_id { field: order.customer_id }
column: date { field: order.order_time }
column: city { field: users.city}
column: age_tier { field: users.age_tier }
column: gender { field: users.gender }
derived_column: num_orders {
sql: COUNT(order.customer_id) ;;
}
}
partition_keys: [ "date" ]
cluster_keys: [ "city", "age_tier", "gender" ]
datagroup_trigger: daily_datagroup
}
}
Dukungan dialek untuk cluster_keys
Kemampuan untuk menggunakan cluster_keys bergantung pada dialek database yang digunakan koneksi Looker Anda. Dalam rilis Looker terbaru, dialek berikut mendukung cluster_keys:
| Dialek | Didukung? |
|---|---|
| Actian Avalanche | |
| Amazon Athena | |
| Amazon Aurora MySQL | |
| Amazon Redshift | |
| Amazon Redshift 2.1+ | |
| Amazon Redshift Serverless 2.1+ | |
| Apache Druid | |
| Apache Druid 0.13+ | |
| Apache Druid 0.18+ | |
| Apache Hive 2.3+ | |
| Apache Hive 3.1.2+ | |
| Apache Spark 3+ | |
| ClickHouse | |
| Cloudera Impala 3.1+ | |
| Cloudera Impala 3.1+ with Native Driver | |
| Cloudera Impala with Native Driver | |
| DataVirtuality | |
| Databricks | |
| Denodo 7 | |
| Denodo 8 & 9 | |
| Dremio | |
| Dremio 11+ | |
| Exasol | |
| Google BigQuery Legacy SQL | |
| Google BigQuery Standard SQL | |
| Google Cloud PostgreSQL | |
| Google Cloud SQL | |
| Google Spanner | |
| Greenplum | |
| HyperSQL | |
| IBM Netezza | |
| MariaDB | |
| Microsoft Azure PostgreSQL | |
| Microsoft Azure SQL Database | |
| Microsoft Azure Synapse Analytics | |
| Microsoft SQL Server 2008+ | |
| Microsoft SQL Server 2012+ | |
| Microsoft SQL Server 2016 | |
| Microsoft SQL Server 2017+ | |
| MongoBI | |
| MySQL | |
| MySQL 8.0.12+ | |
| Oracle | |
| Oracle ADWC | |
| PostgreSQL 9.5+ | |
| PostgreSQL pre-9.5 | |
| PrestoDB | |
| PrestoSQL | |
| SAP HANA | |
| SAP HANA 2+ | |
| SingleStore | |
| SingleStore 7+ | |
| Snowflake | |
| Teradata | |
| Trino | |
| Vector | |
| Vertica |