HouseTrip Deck

If you really, really have a good reason to write raw SQL (generally a bad practice), make sure you use the right call. Avoid ActiveRecord::Base.connection.execute in general, in particular...

...This is particular interesting if you want to combine complex named scopes with raw SQL (i.e. complex selects with functions) and inject the conditions on the where clause. Unfortunately if...

Best results in other decks

...behavior and implementation. PostgreSQL Timeout Type: statement_timeout Scope: Applies to all types of SQL statements (SELECT, INSERT, UPDATE, DELETE). Units: Can be specified in various time units (milliseconds, seconds...

...to the timeout (ERROR: canceling statement due to statement timeout (PG::QueryCanceled)). If multiple SQL statements appear in a single simple-query message, the timeout is applied to each statement...

When debugging slow SQL queries, it’s helpful to understand the database engine's query plan. Whenever you execute a declarative SQL query, the database generates a "query plan" that...

...Most of the time, we don’t need to worry about this plan because SQL engines are highly optimized and can generate efficient execution strategies automatically. However, if a query...

Search in all decks