Live data from Hacker News

Getting AI to write good SQL

cloud.google.com

371–379 of 379 posts

Re: Getting AI to write good SQL

#371

Earlier quoted context omitted.

A junior in SQL would need AI to write things they're not sure about, the same way stackoverflow has helped us for many many years before AI. A senior in sql, and in fact any languages, would use AI to be accelerated (I know I do).

I see this comparison too often and I don't think it's fair. Stackoverflow has peer review.

It's a fair statement. Good point.

Re: Getting AI to write good SQL

#372

Earlier quoted context omitted.

I wish my AI would tell me when I'm going in the wrong direction, instead of just placating my stupid request over and over until I realize.. even though it probably could have suggested a smarter direction, but instead just told me "Great idea! "

I don't know if you have used 2.5, but it is the first model to disagree with directions I have provided... "..the user suggests using XYZ to move forward, but that would be rather inefficient, perhaps the user is not totally aware of the characteristics of XYZ. We should suggest moving forward with ABC and explain why it is the better choice..."

Have you noticed the most recent one, gemini-2.5-pro-0506, suddenly being a lot more sycophantic than gemini-2.5-pro-0325? I was using it to beta-read and improve a story (https://news.ycombinator.com/item?id=43998269), and when Google flipped the switch, suddenly 2.5 was burbling to me about how wonderful and rich it was and a smashing literary success and I could've sworn I was suddenly reading 4o output. Disconcerting. And the AI Studio web interface doesn't seem to let you switch back to -0325, either... (Admittedly, it's free.)

Re: Getting AI to write good SQL

#373

Earlier quoted context omitted.

Electricity in the US currently hovers around 20 cents per kWh; 1 kWh gets you somewhere on the order of 1000 ChatGPT queries. So that's about 0.02 cents per query. At the current US federal minimum wage of $7.25, that means you would need to work for about 0.1 seconds to afford the electricity bill for one query. Maybe 1 full second for one of the really hard ones. So my serious answer to your question is, I'm prett…

I apologize for being excessively metaphorical and using "the electricity bill" to refer to the overall cost of using AI. That said, it should be clear to you that any future pricing of AI services after the currently ongoing honeymoon period will need to recover the initial investments that have happened in the past years, pay for silicon, and make some profit too.

Actually, no, that's not clear to me either. While profit is certainly always what private enterprises aim for, it's also possible they will simply fail at it. Companies go bankrupt all the time. Those investments might simply be lost as other, better, cheaper options become available.

Nowhere should give us more confidence in this outcome being not just possible but likely, over the next 5-10 years, than the rapid growth of locally runnable models. There the fixed cost really is market rate silicon and the ongoing variable costs simply market rate electricity. So I don't even think you were being excessively metaphorical with that. That is actually where the price will head.

Re: Getting AI to write good SQL

#374
post #309

Earlier quoted context omitted.

It's better for society to get much wealthier, much faster, by opening up the possibility for anyone to do advanced programming, than for a small class of anointed and studied elites to get rich via this exclusion. It's the opposite of sad. It's the best thing that ever happened for the productive use of a computer by a layperson since the invention of the search engine.

LLMs are not going to allow you to do advanced programming if you couldn't already do it by hand. The thing about LLMs is, they are a force multiplier, imperfectly, but I guess they are getting there. The overall vision (unless trivial), architecture, functionality-gaps-filling, revisions, etc. of an advanced project is not going to come from an LLM. I personally don't think we are ever going to get to that point whe…

>LLMs are not going to allow you to do advanced programming if you couldn't already do it by hand.

This is simply false. I have empirically already seen many people get LLMs to write code they couldn't do by hand in any reasonable time frame. ("Let me take a 3 month course on Python and then get back to writing this pandas script by hand" is not a reasonable time frame when your competition can pump it out for you in 30 seconds.)

Some of these people go on to learn how to code themselves, but others are perfectly happy with treating the results they're currently getting as a black box. LLMs are a force multiplier on general productivity moreso than they are on programming ability specifically.

>[I]t would be economically very valuable, and you can bet that functionality is not going to be casually enabled in LLMs

But nothing else in the world works like this. An economically very valuable thing is, almost by definition, something with a lot of demand for it. That's like saying Excel would be so valuable if only it could do math, so of course Microsoft isn't going to put a calculator into its spreadsheet program.

Re: Getting AI to write good SQL

#375

If a lot of the value in a company is the software and over time a handful of AI companies start writing all the software, who really ends up owning all the value of the company?

That’s easy. None of the value is in the software. The only value is in customers that use the software.

So again, no software, no customers, no value.

Those who provide AI to create the software will eventually take the customers directly. At that point, many existing companies of all kinds will just sort of be an unncessary intermediary.

It's not too different from how Amazon Basics monitored third party products sold on their site and eventually created a lower cost, often better product, to compete with them. Ultimately stealing their customers.

Re: Getting AI to write good SQL

#378
post #259

Earlier quoted context omitted.

Only if you want a production-ready output. To get execs able to self-feed enough, this works fine. Look, you don’t see value until it’s perfect. Good, other people do. I see your fallacy and raise you a false dichotomy.

The problem I see is how do you verify that the result of your text-to-sql is really what you were asking for, without understanding the SQL (or “the algorithm”)? It boils down to that you have to know what you are doing, and with the present state of art of AI we can’t have confidence in that.

I’m assuming exploratory work from the exec, not something they make decisions with or put into production. If you need something you can trust, you typically need a lot of checks, including multiple humans.

I play a weird part at work near AI. I use it all the time but I’m the first person to warn everyone that it’s absolutely not trustworthy. No matter your prompt, the data, the guidelines built into it, the output is fundamentally flaky. But I use it while knowing that and working around it. Making the process reliable is a big part of my focus, and usually that means minimising the part the LLM plays. Checks and balances live where things are predictable.

Re: Getting AI to write good SQL

#379

Can I just say that Google AI Studio with latest Gemini is stunningly, amazingly, game changingly impressive. It leaves Claude and ChatGPT's coding looking like they are from a different century. It's hard to believe these changes are coming in factors of weeks and months. Last month i could not believe how good Claude is. Today I'm not sure how I could continue programming without Google Gemini in my toolkit. Gemini…

6451937099
Post reply on HN