I’m creating indexes for my models right now and I want to know how MySQL and PostgreSQL deal with an index with more than 1 column like:
add_index :users, [:username, :created_at]
That should utilize the index when I do a query like (I think):
User.where("username = ? and created_at > ?", 'jim', DateTime.now.yesterday)
But will it also utilize the index if I only use the username in a query?
User.where("username = ?", 'jim')