4 ms·
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 a
by andrewstuart 2y ago
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.
- cyanydeez 2y agothen have corporate knock on your teams window asking why all it's IP ended up in a Chinese competitor?
- junaru 2y agoSchema != data.
- PittleyDunkin 2y agoIt's certainly data to the extent that it's copyrightable. I doubt this sentiment would stand up in court.
- jrpelkonen 2y ago“Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious.” - Fred Brooks
- josephg 2y agoYep, but if you think your database schema is "secret sauce", you're fooling yourself. You can almost always guess the database schema if you're given 10 minutes to play with the application.
- deleted 2y ago[deleted]
- hobs 2y agoGenerally your schema is your code, which IS your IP - your data is often NOT your IP (and often might just be a list of facts, a thing which is not copyrightable)
- bilekas 2y agoPeople have too much faith in LLM's at the moment. This might be able to give some insights, but if you're trying to LEARN something in detail, such as the pros and cons on a particular custom query on your unuiqe-ish schema.. The LLM will be prone to making stuff up by design, it wasn't trained on YOUR data.. It will give some good basic results and probably some functional queries, but it misses the mark with the finer points of optimization etc. If you don't know how to properly build the queries, go learn it properly with confidence that what you're learning is actually reliable.
- cpursley 2y agoThis is similar to what I’ve done with my sass where most of the logic lives in Postgres. I went through much of the logic and refactored it with GPT a while back and improved it significantly. It’s soooo good with SQL. Like insanely good. And these days I'm using Claude for all things code, which is significantly better than GPT.
- sgarland 2y agoAgreed that LLMs are quite good at SQL (and relational algebra). However, ask yourself this: how many programming languages do you know to at least a comfortable level? If N > 1, why not add another (SQL)? It’s not a difficult language, which is in part why LLMs are so good at it – it’s easy to predict the next token, because there are so few of them.
- cpursley 2y agoI know SQL pretty well (enough to write complex procedures) and prefer it over doing biz logic in application code (yuck ORMs). But SQL is just such a wonky syntax that I appreciate any help that I can get.