当我在查询下运行时
explain
select count(*) over() as t_totalcnt, max(hits) over() as t_maxhits, max(bytes) over() as t_maxbytes, *
from
(
select category,sum(hits) as hits,sum(bytes) as bytes
from (
select "5mintime",category,hits,bytes,appid, 0 as tmpfield
from web_categoryutfv1_24hr_ts_201209
where "5mintime" >='2012-09-12 00:00:00' and "5mintime" < '2012-09-19 00:00:00'
) as tmp
where "5mintime" >='2012-09-12 00:00:00'
and "5mintime" <= '2012-09-18 23:59:59'
and appid in ('') group by category order by hits desc
) as foo
limit 10;
我得到以下输出
Limit (**cost=31.31..31.61** rows=10 width=580)
-> WindowAgg (**cost=31.31..32.03** rows=24 width=580)
-> Subquery Scan foo (cost=31.31..31.61 rows=24 width=580)
-> Sort (**cost=31.31..31.37** rows=24 width=31)
Sort Key: (sum(web_categoryutfv1_24hr_ts_201209.hits))
-> HashAggregate (**cost=30.39..30.75** rows=24 width=31)
-> Seq Scan on web_categoryutfv1_24hr_ts_201209 (cost=0.00..27.60 rows=373 width=31)
Filter: (("5mintime" >= '2012-09-12 00:00:00'::timestamp without time zone)
AND ("5mintime" < '2012-09-19 00:00:00'::timestamp without time zone)
AND ("5mintime" >= '2012-09-12 00:00:00'::timestamp without time zone)
AND ("5mintime" <= '2012-09-18 23:59:59'::timestamp without time zone)
AND ((appid)::text = ''::text))
当我在没有解释标签的情况下运行上面的查询时。我在 1 秒内得到输出,而这里 cost=31.31..31.61。
任何人请帮我理解解释计划中的成本关键字是什么意思我的意思是解释计划中的成本关键字单位?