用量
view: my_view {
derived_table: {
distribution_style: all
...
}
}
|
階層
distribution_style- 或 - distribution_style |
預設值
無
接受
分配樣式 (all 或 even)
特別規則
distribution_style 僅支援特定方言
|
定義
distribution_style 可讓您指定如何將永久衍生資料表 (PDT) 或匯總資料表的查詢,分配到資料庫中的節點。
如需支援
distribution_style的方言清單,請參閱「支援distribution_style的方言」一節。
distribution_style參數只能搭配持續性資料表使用,例如 PDT 和匯總資料表。如果衍生資料表沒有持續性策略,則不支援「distribution_style」。
此外,使用
create_process或sql_create定義的衍生資料表不支援distribution_style參數。最後,請勿同時使用
distribution_style和distribution。如要根據資料欄值將資料表中的資料列分配至不同的 Redshift 節點,請使用distribution。如要選擇其他發布策略,請使用distribution_style。
Redshift 提供四種分配樣式,詳情請參閱 Amazon Redshift 說明文件中的分配樣式:
- ALL Distribution:所有資料列都會完整複製到每個節點。如要在 Looker 中完成這類分配作業,請使用
distribution_style: all。 - EVEN 分配:資料列會以循環方式分配至不同節點。如要在 Looker 中完成這類分配作業,請使用
distribution_style: even。 - 鍵值分配:系統會根據特定資料欄中的不重複值,將資料列分配至不同節點。如要在 Looker 中完成這類分配作業,請使用
distribution參數。 - 自動分配:Redshift 會根據資料表資料大小,指派最佳分配樣式。Looker 不支援這類發布類型。
如要選擇合適的分配策略,請參閱 Amazon Redshift 說明文件中的分配樣式。如未指定 distribution_style,且未使用 distribution 參數,Looker 會預設為 all。
範例
建立 customer_order_facts 衍生資料表,並將分配樣式設為 all:
view: customer_order_facts {
derived_table: {
sql:
SELECT
customer_id,
COUNT(*) AS lifetime_orders
FROM
order
GROUP BY 1 ;;
persist_for: "24 hours"
distribution_style: all
}
}
支援 distribution_style 的方言
使用 distribution_style 的能力取決於 Looker 連線使用的資料庫方言。在最新版 Looker 中,下列方言支援 distribution_style:
| 方言 | 是否支援? |
|---|---|
| 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 |