June 28, 2024, 11:16 p.m. | Michael Chaney

DEV Community dev.to

Just found something very interesting in PostgreSQL, thanks to Claude.


I have a really nasty query on some huge tables. Here's the basic layout that we're concerned with:



class RawRoyaltyRecord < ApplicationRecord
belongs_to :royalty_input_batch_partial
belongs_to :track
has_many :raw_royalty_records_sales
end

class RoyaltyInputBatchPartial < ApplicationRecord
belongs_to :pro
has_many :raw_royalty_records
end

class RawRoyaltyRecordsSale < ApplicationRecord
belongs_to :raw_royalty_record
belongs_to :sale
end


Don't worry about "Pro" and "Sale" - we just need their IDs.


The concept is this. We get spreadsheets in every quarter or …

basic class claude found postgresql query records something tables

Data Engineer

@ Michelin | Pune

Senior Research Analyst, Global Analytics & Measurement

@ NBCUniversal | London, United Kingdom

Research Scientist

@ Meta | Menlo Park, CA

NLP Speech Research Intern

@ Tencent | UK-London

Junior Senior Reliability Engineer

@ NielsenIQ | Bogotá, Colombia

[Job - 15712] Vaga Afirmativa para Mulheres - QA (Automation), SR

@ CI&T | Brazil