News for hackers. Stuff that matters.
Re:Show HN: Natural-SQL-7B, a strong text-to-SQL model by fijiaarone on Monday February 05, 2024 @07:37PM (#39269251)
I wonder if anyone realizes that selects and joins in every database are implemented literally with for loops written in c.

The reason people use a relational database is because it has loops that are faster, safer, and more efficient than anything you can write.

Re:Show HN: Natural-SQL-7B, a strong text-to-SQL model by fifilura on Tuesday February 06, 2024 @01:55AM (#39271550)
What does it matter? Yeah, at the very bottom of it all there will be a loop. I wouldn't attribute that to C but to the von Neumann architecture.

The point is that by getting rid of loops you remove one way of telling the computer "How" to do it. Start here, do it in this order, combine the data this way.

When "How" is a solved problem, it is a waste of your brain to think about that again. "What" is a better use of your brain cycles.

Re:Show HN: Natural-SQL-7B, a strong text-to-SQL model by ako on Tuesday February 06, 2024 @02:10AM (#39271647)
Exactly, SQL is like a very specific natural language used to tell a database what data you need. The database contains AI (the query optimizer) that will use statistics to determine the fastest way to retrieve the data requested. Depending on your query and the data you have the fastest way to get your data will change. It’s hard to manually write this yourself.
Re:Show HN: Natural-SQL-7B, a strong text-to-SQL model by riku_iki on Tuesday February 06, 2024 @05:23PM (#39281624)
> joins in every database are implemented literally with for loops written in c.

different kind of loops can be different, e.g. 2 nested loop with quadratic time:

for i in t1: for j in t2:

vs sort + merge join with n log n time.