COUNT(DISTINCT si) AS "itemCnt",
count(DISTINCT
s.id) AS saleCnt,
count(DISTINCT
p.id) AS "productCnt",
count(DISTINCT
c.id) AS "buyerCnt",
count(DISTINCT cc.catalog_id) AS "catalogCnt",
count(DISTINCT date_trunc('day', s.created)) AS "dayCnt"
один этот кусок говорит, что надо все сжечь и переписать.