Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I recall seeing some gnarly SQL at British Telecom over 2k lines.

Id agree with you about keeping it as simple as possible



People do dumb things with SQL, but depending on the query/set of columns, 2k is a pretty quick line count to reach. Just dont use select *, have a wide table, do more than a few trivial operations moving data around, and you'll get to 2k pretty quick.

That being said, people do dumb stuff with SQL all the time; The worst query I have ever seen was 11MB, megabytes. The worst query plan I have ever seen generated a plan that was ~130MB. I regularly have people ask questions in #sqlhelp (https://sqlps.io/slack/ SQL Server focused) like "Why can I only have 2100 parameters to a stored procedure?" (dude was super mad that I asked if his design might use some rework.)


I've told SQL learners before

There is no Advanced SQL; there's only "a very large amount of SQL", "exotic SQL", and "SQL no one should have written."


Are you sure it wasn't either:

+ a stored procedure

or

+ the end-product of an ORM tool?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: