问题描述
我运行以下查询,这需要50秒。
<!-- build:css css/main.css -->
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css"/>
<link rel='stylesheet' href='./node_modules/font-awesome/css/font-awesome.min.css'/>
<link rel='stylesheet' href='./node_modules/bootstrap-social/bootstrap-social.css'/>
<link rel='stylesheet' href= './css/styles.css'>
<!-- endbuild -->
解释:
select created_at,currency,balance
from YYY
where id in (ZZZ) and currency = 'XXX'
and created_at >= '2020-08-28'
order by created_at desc
limit 1;
然后,我运行以下查询,这是“无限”的时间。等待结束的时间太长。
Limit (cost=100.12..1439.97 rows=1 width=72)
-> Foreign Scan on yyy (cost=100.12..21537.65 rows=16 width=72)
Filter: (("substring"((object_key)::text,'\w+:(\d+):.*'::text))::integer = 723120)
解释:
select created_at,balance
from YYY
where id in (ZZZ) and currency = 'XXX'
and created_at >= NOW() - INTERVAL '1 DAY'
order by created_at desc
limit 1;
这些查询之间有何大的差异?我知道该索引用于提高性能。我们可以从这里推断什么? 任何贡献将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)