These are chat archives for ManageIQ/manageiq/performance

15th
Mar 2016
Keenan Brock
@kbrock
Mar 15 2016 14:14
@matthewd well, this makes me feel better:
explain analyze select val from tst
where val=2 and val>0 and mod(val,2)=0
   or val=2 AND val>0 and val >= 6;
                                          QUERY PLAN                                          
----------------------------------------------------------------------------------------------
 Seq Scan on tst  (cost=0.00..64.00 rows=1 width=4) (actual time=0.012..0.014 rows=1 loops=1)
   Filter: ((val > 0) AND (val = 2) AND ((mod(val, 2) = 0) OR (val >= 6)))
   Rows Removed by Filter: 9
 Planning time: 0.060 ms
 Execution time: 0.031 ms
the filter prunes the duplicate val=2 AND val>0 out
huh. even though I used AND and and - that wasn't intentional
Matthew Draper
@matthewd
Mar 15 2016 14:16
Yeah, I think that's basically why we (Rails) are being lazy about it
Keenan Brock
@kbrock
Mar 15 2016 14:20
now I just have to make sure we dont have any id => array[0..10000] in there
Keenan Brock
@kbrock
Mar 15 2016 14:26
@matthewd ast == arel object?
yea, expected Vm.where(Vm.where(:id => 3)).to_sql to work
Matthew Draper
@matthewd
Mar 15 2016 14:28
Yeah… it doesn't :)
Yes, that's an Arel object — see line 69
Keenan Brock
@kbrock
Mar 15 2016 14:29
thnx