These are chat archives for ManageIQ/manageiq/performance

6th
Oct 2016
Keenan Brock
@kbrock
Oct 06 2016 02:16
yea, I keep stumbling upon this:
create index index_relationships_on_ancestry_scan
    on relationships (ancestry varchar_pattern_ops);
it changes 300ms queries to 0.069s queries
explain analyze
SELECT count(*)
FROM "relationships"
WHERE ("relationships"."ancestry" iLIKE '509000000046999/509000000047000/509000000047001/509000000047186/509000000047247/%'
OR "relationships"."ancestry" = '509000000046999/509000000047000/509000000047001/509000000047186/509000000047247');
not thrilled with the iLIKE but we're not really changing ancestry right now
and the OR clause is not needed either
having said that. I have hit this wall a number of times over the past 1-2 years.
and this index in particular always looks promising.
but for some reason, I always shy away from it
also of interest - converting the ILIKE to a LIKE shows similar promise.
Keenan Brock
@kbrock
Oct 06 2016 02:21
aah - memory returning.
http://blog.bigbinary.com/2016/07/20/rails-5-adds-support-for-expression-indexes-for-postgresql.html
before rails 5, you could not specify operator classes
Jason Frey
@Fryguy
Oct 06 2016 17:31
I mean if that's all it is, just make a PR with that
does ancetry already do the ilike?
(i assume you need the ilike in order to leverage the index's pattern_ops properly)
we also have that one fix I made on ancestry for node arrangement that was never released...
if we can't get ancestry to release, maybe we just fork
Nick LaMuro
@NickLaMuro
Oct 06 2016 18:50
We are pretty far behind in the ancestry gem if I recall correctly, but I think master is still ahead of the gem
Keenan Brock
@kbrock
Oct 06 2016 19:19
@Fryguy rails does ILIKE for all arel_table[:x].matches("%a%") - basically every rails app written
~1 year ago, I added a second parameter in arel
you can produce LIKE for arel_table[:x].matches("%a%", true)
but that is rails 5 only (maybe late rails 4)
I want to add the false into the library
it takes ancestry queries from 300ms to 35ms
so we can fix the index, and speed it up
or we can change ancestry
index is a tiny bit faster - negligible
but it requires a minimum rails version
Keenan Brock
@kbrock
Oct 06 2016 19:47

my fios performance fix:
the verizon person came in,
unplugged the optical cable
plugged it back in.

Déjà vu: fixing people's computers by re-plugging a person's mouse/monitor/cpu

Keenan Brock
@kbrock
Oct 06 2016 19:59
@Fryguy I'm embarassed by ancestry
I would like to change travis to only support reasonable versions of rails and ruby and ask for the keys to push a good version to the gem (version 3.0?)
@chrisarcand ideas on the current way to setup a project to support multiple rails / ruby versions?
I'm not even sure how ancestry works now - always confuses me
Chris Arcand
@chrisarcand
Oct 06 2016 20:02
You either have a gemfile that is set to require certain gem versions on a env var (and then specify multiple versions in your build matrix) or do something a little more complex with multiple gemfile.locks
Keenan Brock
@kbrock
Oct 06 2016 20:03
we have mutltiple gemfiles
how do people set these up
there was a thoughtbot gem and a nother
Chris Arcand
@chrisarcand
Oct 06 2016 20:03
I don’t actually condone using this particular gem because it seems like a lot of needless tooling, but the basic idea is found in https://github.com/thoughtbot/appraisal
Keenan Brock
@kbrock
Oct 06 2016 20:03
and you use wwtd to run them
aah
so you suggest manually doing that
think this may have been using appraisal - can't remember
Chris Arcand
@chrisarcand
Oct 06 2016 20:04
Pretty much. I mean I haven’t actually used appraisal so maybe give it a try, but I just don’t think it’s that hard to merit a DSL for it.
Keenan Brock
@kbrock
Oct 06 2016 20:04
do we need to support rails 3.x?
Chris Arcand
@chrisarcand
Oct 06 2016 20:04
Just needs an env var
Keenan Brock
@kbrock
Oct 06 2016 20:04
this is part of the issue I have with ancestry
it used a gem or something - but the procedure was never published
aah - I see the vendor appraisal gem
Jason Frey
@Fryguy
Oct 06 2016 20:06
config gem uses appraisal...it's pretty simple to use
Keenan Brock
@kbrock
Oct 06 2016 20:06
do we like ancestry enough to push it forward?
it is rotting right now
(kinda like trollop)
Jason Frey
@Fryguy
Oct 06 2016 20:07
"just because it's old does not make it bad"
I don't consider that bitrot...it works
we just need the push keys
Alberto Bellotti
@abellotti
Oct 06 2016 20:07
“it’s so old ….” (there’s gotta be a Pun there with ancestry :) )
Keenan Brock
@kbrock
Oct 06 2016 20:07
lol
Jason Frey
@Fryguy
Oct 06 2016 20:07
if we decide to get away from ancestry, then I would think we would move wholesale to closure_tree
Keenan Brock
@kbrock
Oct 06 2016 20:08
yes
ok to drop rails 3.x and 4.0 support?
I want better arel
keep 4.2 support?
add 5.x support
%w(mysql pg sqlite3).each do |db_type|
  %w(3.0.20 3.1.12 3.2.22 4.0.13 4.1.14 4.2.5).each do |ar_version|
    appraise "#{db_type}-ar-#{ar_version.split('.').first(2).join}" do
      gem "activerecord", ar_version
      gem db_type unless db_type == "sqlite3" # Skip sqlite3 since it's part of the base Gemfile.
    end
  end
end
Jason Frey
@Fryguy
Oct 06 2016 20:08
I would drop unsupported Rails versions on master
where unsupported Rails means "the versions of Rails the Rails core team no longer supports"
drop all but 4.2.x and 5.0
ok