数据表每次在写入后的首次查询就会慢,咋么优化?

Viewed 40

写入是用stream load,每小时写入一次,
每次写入后首次查询:
image.png

第二次查询:
image.png

表结构:

CREATE TABLE `ods_jcyapp_member_content_praises` (
  `id` bigint NOT NULL,
  `member_id` bigint NOT NULL,
  `publish_id` bigint NOT NULL,
  `content_id` bigint NOT NULL,
  `created_at` datetime NOT NULL,
  `is_deleted` tinyint NOT NULL DEFAULT "0",
  INDEX idx_praises_create_at (`created_at`) USING INVERTED COMMENT ''
) ENGINE=OLAP
UNIQUE KEY(`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
);;

doris 版本 2.0.15,3fe 3be部署
数据总大小:
image.png

2 Answers

完整的建表语句?show create table看下?如果是merge on read,确实会这样,可以改成merge on write

这个是我的表结构,没有指明是否为merge on read

CREATE TABLE `ods_jcyapp_member_content_praises` (
  `id` bigint NOT NULL,
  `member_id` bigint NOT NULL,
  `publish_id` bigint NOT NULL,
  `content_id` bigint NOT NULL,
  `created_at` datetime NOT NULL,
  `is_deleted` tinyint NOT NULL DEFAULT "0",
  INDEX idx_praises_create_at (`created_at`) USING INVERTED COMMENT ''
) ENGINE=OLAP
UNIQUE KEY(`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"enable_mow_light_delete" = "false"
);