EXPLAIN Explained video on YouTube
- Tell you why a particular index isn't used
- Explain how to rewrite your queries
- Show what other factors make the DB slow
- Tell you how much time the request took outside the DB
| explain (analyze on, buffers on, verbose on, timing on) | |
| select l.id, l.simulation_id, l.user_id, l.content_package_id, l.score, l.result, l.total_time_taken, l.created_at, l.updated_at | |
| from simulation_results l | |
| inner join ( | |
| select simulation_id, max(created_at) created_at | |
| from simulation_results | |
| where user_id = 827911 | |
| group by simulation_id | |
| ) r | |
| on l.simulation_id = r.simulation_id and l.created_at = r.created_at |
| ruby -W2 -v -e ' (ruby-2.2.2@benchprep) wip-simulation-endpoints 9a603b95e ✗ | |
| puts "before" | |
| module Foo | |
| puts "- Foo -" | |
| end | |
| puts "more" | |
| module Foo::Bar | |
| puts "- Foo::Bar -" | |
| end |
| echo "BEGIN updating: $(pwd)" | |
| cd "$1/.." | |
| git fetch --all --prune --verbose | |
| [[ -a Gemfile && "$(gem query --installed '^bundler$')" == 'false' ]] && gem install bundler --no-document | |
| bundle check || bundle install |
| brew tap homebrew/versions | |
| brew install v8-315 | |
| brew unlink v8-315 && brew link v8-315 | |
| brew link --force v8-315 | |
| bundle config --global build.libv8 --with-system-v8 | |
| bundle install --full-index --jobs 4 --clean |
| # Simple logger | |
| logger = Logger.new(STDOUT) | |
| # Some object | |
| Foo = Struct.new(:hello, :goodbye) | |
| foo = Foo.new | |
| foo.hello = 'Hola' | |
| foo.goodbye = 'Adiós' |
| require 'forwardable' | |
| class Said | |
| attr_reader :msg | |
| def initialize(msg = nil) | |
| @msg = (msg || '').freeze | |
| end | |
| def loud_enough? |
| puts "<< De Morgan's laws >>\n\n" | |
| PAIRS = [ | |
| [false, true], | |
| [true, false], | |
| [true, true], | |
| [false, false] | |
| ] | |
| puts "\"NOT (A AND B)\" is the same as \"(NOT A) OR (NOT B)\"" |
| The original works were financially inert. They were posted out on the web for anyone to see them. | |
| An artist sees the works, likes them. | |
| Takes those selected works, enlarges, fine-tunes, prints, frames, and displays the works inside a context. | |
| The artist then puts those pieces on display and for sale. | |
| What is for sale? |
| git-assume-unchangeable () { | |
| git update-index --assume-unchanged "$@" | |
| } | |
| git-assume-changeable () { | |
| git update-index --no-assume-unchanged "$@" | |
| } | |
| git-show-unchangeable () { | |
| git ls-files -v | grep -e "^[hsmrck]" |