shlogg · Early preview
Augusts Bautra @augustsbautra

Senior Rails developer from Latvia. Avid gamer. Longevity enthusiast. #keto-dude

Optimizing UNION Queries: From 30s To Under 1s Report Generation Time

Debugging performance issues in reports led to a breakthrough: replacing WHERE field IN with WHERE EXISTS (SELECT 1 ...) improved query time from 30s to under 1s!

Prevent Race Conditions With Retryable In Rails

Wrap .first_or_create!/find_or_create_by! calls in retryable block to prevent race conditions. Use Retryable gem with on: [ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid] for a clean solution.

Domain Query Interface In Ruby: A Code Challenge Takeaway

Participated in code challenge despite illness, focusing on Domain Query Interface & entity-based operations. Learned to optimize game state & debugging info for reproducibility.

Buffered Bulk Updates For Efficient Database Operations

Optimizing import logic with buffered bulk updates: collect updates in a buffer, perform upsert_all when reaching batch_size, reducing DB roundtrip overhead and improving performance.