Dump your schema, drop the entire thing into ChatGPT or Claude and ask it to write your Postgres query.
Then ask it to rewrite the query three different ways and explain the pros and cons of each.
Do the same for any existing queries in your system … drop in the schema then the query and ask for an analysis and suggested improvements.