This message was deleted.
# general
s
This message was deleted.
j
Hi Rahul, Took me a while to format this so that it is readable, but a couple of thoughts on the SQL side of things: On that last select list item:
Copy code
cast(((sum("Calc_Net_Amt(sales_master)")/(select sum(a) from (
         select sum("Calc_Net_Amt(sales_master)") as a, 'dummy' as b
           from sales_master_COM101 
          group by 2
        ))))*100.0 as DECIMAL ),
I don't think you need to add the cartesian product to do the grouping ... in SQL you can do aggregates without a group by, and you don't need the secondary grouping and aggregate, so just:
Copy code
cast( sum("Calc_Net_Amt(sales_master)" / 
              (select sum("Calc_Net_Amt(sales_master)") from sales_master_COM101)
        )*100.0 as DECIMAL ),
I also don't know if Druid will try to execute that subquery for each select list item, so for safety (and maybe easier reading) I suggest turning that into a CTE at the beginning of the query, e.g.:
Copy code
with tmp_total as (
 select sum("Calc_Net_Amt(sales_master)") as TotalAmt from sales_master_COM10
)
 select ...
   from sales_master_COM101 cross join tmp_total
  where ...
=== On the cluster config side, I would think to increase processing threads to something higher ... the segment scans are spread across the number of processing threads ... currently each thread has to process 49/3 = 17 segments ...