These are chat archives for ManageIQ/manageiq/performance

20th
Oct 2016
Keenan Brock
@kbrock
Oct 20 2016 14:03
up a little late, but @NickLaMuro I finally cracked the nut for the tree - with an expanded node. Master is already much faster than pre euwe
ms queries query (ms) rows comments
22,630.0 289 21,439.7 1,925 master
21,458.7 229 20,328.4 1,925 #12072
3,518.2 229 2,537.6 759 after
3,468.6 228 2,538.7 755 after + lambda
for some reason, a count(*) is faster than select * .to_a.size
Nick LaMuro
@NickLaMuro
Oct 20 2016 14:44
^ is that last bit sarcasm?
Keenan Brock
@kbrock
Oct 20 2016 15:18
yes
sorry - you caught me
Nick LaMuro
@NickLaMuro
Oct 20 2016 15:22
what is the "after" change?
Keenan Brock
@kbrock
Oct 20 2016 15:28
after my current PR
very close
ok
you know how I talk about "ilike" vs "like" and saying it makes a difference?
for the http://localhost:3000/ems_infra/:id?display=ems_folders
it has a lot of counts right?
changing the counts from ilike to like converts each count from 300ms to 30ms
think a bunch of the savings is from that alone
really need to get that into ancestry
Nick LaMuro
@NickLaMuro
Oct 20 2016 15:30
neat, that is cool
Keenan Brock
@kbrock
Oct 20 2016 15:30
a lot of the fix is changing objects_or_count_only(x) + objects_or_count_only(y)
I had fixed it to not force downloading everything - big savings (month ago)
but now, the question is, why even call the second one if we just want .any? / .exists? in the end
Keenan Brock
@kbrock
Oct 20 2016 15:40
@NickLaMuro ok, so after == #12072 - I may need to split it up a little, but need a big picture PR - too hard for me to get timings for all these nuances
Keenan Brock
@kbrock
Oct 20 2016 15:47
ok, updated numbers. looks like it is a big win - 83% faster, 61% fewer rows
Nick LaMuro
@NickLaMuro
Oct 20 2016 15:52
\o/
Keenan Brock
@kbrock
Oct 20 2016 17:15
@arcolife mongo is web scale has to be the best video ever
Keenan Brock
@kbrock
Oct 20 2016 18:13

@NickLaMuro so I made some changes and all. turns out the improvement was a side effect...

The real improvement is I changed the method I called in ancestry:

 def descendant_conditions
   t = get_arel_table
-  t[get_ancestry_column].matches("#{child_ancestry}/%").or(t[get_ancestry_column].eq(child_ancestry))
+  t[get_ancestry_column].matches("#{child_ancestry}/%", nil, true).or(t[get_ancestry_column].eq(child_ancestry))
 end
ms queries query (ms) rows comments
23,076.9 289 21,572.2 1,925 master
5,245.0 289 4,106.3 1,925 new match syntax
granted, the other changes halfs it again. but they are not responsible for the majority of the changes
Dennis Metzger
@dmetzger57
Oct 20 2016 18:14
that’s an :eyes: opener
Nick LaMuro
@NickLaMuro
Oct 20 2016 18:15
How does that affect what SQL is generated?
Keenan Brock
@kbrock
Oct 20 2016 18:15
this is the ancestry thing I'm trying to tackle. how to introduce a rails 5.0 only change
Nick LaMuro
@NickLaMuro
Oct 20 2016 18:15
the , nil, true that is
Keenan Brock
@kbrock
Oct 20 2016 18:15
ancestry ilike 'abc/%' => ancestry like 'abc/%'
Nick LaMuro
@NickLaMuro
Oct 20 2016 18:16
Okay, so this is still the difference between like and ilike
Keenan Brock
@kbrock
Oct 20 2016 18:16
yes
I knew it was big and all
it basically makes relationships easier ;)
or not so taxing
because relatinships are hard enought as it is
Nick LaMuro
@NickLaMuro
Oct 20 2016 18:19
filters himself from making relationship jokes
Keenan Brock
@kbrock
Oct 20 2016 18:19
thanks - one trukey is enough for a channel
I really want a :turkey: emoji
Nick LaMuro
@NickLaMuro
Oct 20 2016 18:19
:bird: