CREATE INDEX idx_e_d ON public.expense USING btree (date);
explain select * from "public"."expense" where date > '2018-12-19'
Seq Scan on expense (cost=0.00..15133.15 rows=181367 width=41)
Filter: (date > '2018-12-19 00:00:00'::timestamp without time zone)
explain select * from "public"."expense" where date > '2018-12-20'
Bitmap Heap Scan on expense (cost=5245.18..14770.65 rows=162678 width=41)
Recheck Cond: (date > '2018-12-20 00:00:00'::timestamp without time zone)
-> Bitmap Index Scan on idx_e_d (cost=0.00..5204.51 rows=162678 width=0)
Index Cond: (date > '2018-12-20 00:00:00'::timestamp without time zone)
日期差一天,不走索引,用的是阿里云的 postgresql 9.4 2 核 4g
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.