我有一个看起来像这样的查询:
SELECT
DISTINCT "articles"."id",
"articles"."company_uuid",
"articles"."status",
"articles"."discount_reference",
"articles"."created_at"
--- more columns
FROM
"articles"
INNER JOIN "customers" ON "customers"."rec" = 'f'
AND "customers"."article_id" = "articles"."id"
WHERE
"articles"."type" = 'sending_request'
AND "articles"."hidden" = 'f'
AND "articles"."discount_reference" = 'Discount/737251623'
AND "articles"."api_domain" = 'company'
AND "articles"."status" IN ('completed', 'active')
AND (customers.search_text ILIKE unaccent('%verb%'))
ORDER BY
authored_on DESC NULLS LAST
LIMIT
20 OFFSET 0;
第一个查询很慢,但当我重新运行时它总是更快。当我比较计划时,我没有看到明确的答案。我有一个用于客户搜索文本的杜松子酒三元组索引。
https://explain.dalibo.com/plan/b11657f576699fa8
第二轮
https://explain.dalibo.com/plan/g81h74b9g521g5e7
IO 和缓冲区的差异是差异的根源吗?
我在 RDS 上运行 PostgreSQL 14。