r/SQL • u/metric_skeptic • Sep 09 '26
Discussion How much SQL do you still write manually?
With AI getting better at writing SQL, I’ve been wondering how much SQL analysts actually write from scratch these days.
Do you still write most of your queries manually, or do you use AI for things like joins, CTEs, debugging, optimization, etc.?
And has your use of AI actually changed how much SQL you need to know?
115
Upvotes
View all comments
Show parent comment
-1
u/Thadrea Data Science Manager Sep 09 '26
Elaborate on what, exactly? 200-line queries are typically an unmaintainable mess.
There are many situations where you need 200+ lines of logic to implement a specific set of requirements, yes. A well-managed codebase would separate those 200+ lines into smaller chunks that are individually understandable, versioned and diff-able.
Putting it all into one monster query is a serious anti-pattern and I'm not going to pretend that it isn't--Not only is it bad for the developers but it also bad for the database. Query planners necessarily get less and less effective at optimizing the tasks put to them the more and more convoluted a query gets.