brew tap simon-engledew/gocmdpev
brew install gocmdpev
irb(main):002:0> Coach.all.eyeballs.explain
Coach Load (1.0ms) SELECT "coaches".* FROM "coaches"
=> ["Seq Scan on public.coaches (cost=0.00..15.60 rows=560 width=116) (actual time=0.005..0.006 rows=11 loops=1)\n Output: id, first_name, last_name, email, created_at, updated_at\n Buffers: shared hit=1\nPlanning Time: 0.042 ms\nExecution Time: 0.014 ms"]
irb(main):003:0> Coach.all.eyeballs.gocmdpev
Coach Load (0.5ms) SELECT "coaches".* FROM "coaches"
[[{"Plan"=>{"Node Type"=>"Seq Scan", "Parallel Aware"=>false, "Relation Name"=>"coaches", "Schema"=>"public", "Alias"=>"coaches", "Startup Cost"=>0.0, "Total Cost"=>15.6, "Plan Rows"=>560, "Plan Width"=>116, "Actual Startup Time"=>0.005, "Actual Total Time"=>0.006, "Actual Rows"=>11, "Actual Loops"=>1, "Output"=>["id", "first_name", "last_name", "email", "created_at", "updated_at"], "Shared Hit Blocks"=>1, "Shared Read Blocks"=>0, "Shared Dirtied Blocks"=>0, "Shared Written Blocks"=>0, "Local Hit Blocks"=>0, "Local Read Blocks"=>0, "Local Dirtied Blocks"=>0, "Local Written Blocks"=>0, "Temp Read Blocks"=>0, "Temp Written Blocks"=>0}, "Planning Time"=>0.052, "Triggers"=>[], "Execution Time"=>0.018}]]
sh: line 1: 8581 Done cat /var/folders/cn/tqx1mz797f7dpbwwm03nb7k80000gn/T/pg-eyeballs20200410-8566-sd2ddt
8582 Segmentation fault: 11 | gocmdpev
=> nil
So the "explain" seems to work but it's the gocmdpev that is failing for some reason (or the piping of the output that is failing)...