sql - PSQL request too slow. How to fix it? -
sql - PSQL request too slow. How to fix it? -
select count(a)/count(s)*100 aratio, count(b)/count(s)*100 bratio, count(c)/count(s)*100 cratio, count(a), count(b), count(c), count(s) (select count(cid) images width > height , category_id = 4 grouping cid) aq, (select count(cid) b images width < height , category_id = 4 grouping cid) bq, (select count(cid) c images width = height , category_id = 4 grouping cid) cq, (select count(cid) s images category_id = 4 grouping cid) sq;
how can create request more effective?
it possible using with. move queries with , modify them little: alter count(cid) count(distinct cid) , remove group by clause @ all.
sql postgresql datatable count subquery
Comments
Post a Comment