Explain Rails Active Record Query

You can output the raw query for an Active Record Query by tagging .explain at the end. Very useful for complex queries where it’s hard to understand what is happening under the hood 🤯. You can read the docs for more info.

Laravel Eloquent Select Column as Alias

If you’re like me and like to use select statements to return specific columns. You’ll be happy to know that Eloquent allow you to use select column as alias just like in SQL. Which can be make things a breeze, depending on what you are doing. Remember to use the dot syntax to specify a … Read more

Postgres Delete Duplicate Rows

This query is to delete duplicate rows on multiple selected columns for Postgres. Just plug in the table_name and columns you want to evaluate duplicates on. This query is the fastest out of several I’ve tried, evaluating and deleting 5 million duplicate rows on 8 columns in about 20 seconds.