企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
mycat、doris 进入doris,使用查询表建表语句命令:show create table fq\_buried\_points\_B\_00;,可以查询到该表的建表语句,如图所示: ![](https://img.kancloud.cn/fa/ff/faff7cbf9f4c4125ae5955c9dbd50712_1752x836.png) 建表语句拿出来如下: ``` CREATE TABLE `fq_buried_points_B_00` ( `created_at` datetime NOT NULL, `source_month` int(11) NOT NULL, `source_id` DECIMAL(20, 0) NOT NULL, `event_type` tinyint(4) NOT NULL, `event_id` varchar(124) NOT NULL, `date` int(11) NOT NULL, `app_id` int(11) NOT NULL, `system` tinyint(4) NOT NULL, `user_id` int(11) NOT NULL, `user_type` tinyint(4) NOT NULL, `channel_id` int(11) NOT NULL, `country_code` bigint(20) NOT NULL, `page_source` bigint(20) NOT NULL, `page_target` int(11) NOT NULL, `book_id` bigint(20) NOT NULL, `chapter_id` int(11) NOT NULL, `relation_id` int(11) NOT NULL, `relation_type` varchar(124) NOT NULL, `operated_at` int(11) NOT NULL, `app_version` varchar(124) NOT NULL, `api_version` varchar(124) NOT NULL, `device_brand` varchar(124) NOT NULL, `device_model` varchar(124) NOT NULL, `client_ip` varchar(252) NOT NULL, `extra_info` varchar(4092) NOT NULL, `updated_at` datetime NOT NULL ) ENGINE=OLAP UNIQUE KEY(`created_at`, `source_month`, `source_id`) COMMENT 'OLAP' PARTITION BY RANGE(`created_at`) (PARTITION p202405 VALUES [('2024-05-01 00:00:00'), ('2024-06-01 00:00:00')), PARTITION p202406 VALUES [('2024-06-01 00:00:00'), ('2024-07-01 00:00:00')), PARTITION p202407 VALUES [('2024-07-01 00:00:00'), ('2024-08-01 00:00:00')), PARTITION p202408 VALUES [('2024-08-01 00:00:00'), ('2024-09-01 00:00:00')), PARTITION p202409 VALUES [('2024-09-01 00:00:00'), ('2024-10-01 00:00:00')), PARTITION p202410 VALUES [('2024-10-01 00:00:00'), ('2024-11-01 00:00:00')), PARTITION p202411 VALUES [('2024-11-01 00:00:00'), ('2024-12-01 00:00:00')), PARTITION p202412 VALUES [('2024-12-01 00:00:00'), ('2025-01-01 00:00:00')), PARTITION p202501 VALUES [('2025-01-01 00:00:00'), ('2025-02-01 00:00:00')), PARTITION p202502 VALUES [('2025-02-01 00:00:00'), ('2025-03-01 00:00:00'))) DISTRIBUTED BY HASH(`created_at`) BUCKETS 10 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "is_being_synced" = "false", "dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "MONTH", "dynamic_partition.time_zone" = "Europe/London", "dynamic_partition.start" = "-2147483648", "dynamic_partition.end" = "3", "dynamic_partition.prefix" = "p", "dynamic_partition.replication_allocation" = "tag.location.default: 1", "dynamic_partition.buckets" = "10", "dynamic_partition.create_history_partition" = "true", "dynamic_partition.history_partition_num" = "6", "dynamic_partition.hot_partition_num" = "0", "dynamic_partition.reserved_history_periods" = "NULL", "dynamic_partition.storage_policy" = "", "dynamic_partition.start_day_of_month" = "1", "storage_format" = "V2", "light_schema_change" = "true", "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); ``` 上述将一张表按照日期和bucket通在内部又重新按照时间分区、分桶再区分 ![](https://img.kancloud.cn/59/fa/59faf2d1812d877ac7265d8a209ef02e_830x428.png)