Live data from Hacker News

A future for SQL on the web

jlongster.com

201–210 of 227 posts

Re: A future for SQL on the web

#201
post #199

Earlier quoted context omitted.

> Very few people are using Chrome-only APIs which are not in the standards yet. So it's not really a concern. Ah yes. But SQlite not having competing independent implementations somehow is? Also, "not many people using something" is not as great an argument as you think it is. See, for example, the latest problem with browsers deciding to remove alert/prompt/confirm: https://dev.to/richharris/stay-alert-d > The web…

> Ah yes. But SQlite not having competing independent implementations somehow is? Except that's not why it was culled. The reasons are discussed in great detail on this thread and elsewhere. > non-standards that Chrome pushes (many of which will never get a different implementation because both Safari and Mozilla consider them harmful) are good I'm saying nobody uses those Chrome only APIs, until they become standard…

> I'm saying nobody uses those Chrome only APIs, until they become standards

Ah yes. Once Chrome releases something in stable, literally no one ever uses those APIs, no one. And even Google's propaganda machine doesn't tell you to use them (example: https://web.dev/usb/)

> Or are you against experimentation?

I'm not. What Google does isn't experimentation.

Re: A future for SQL on the web

#202
post #157

Earlier quoted context omitted.

If anyone else is curious https://insights.stackoverflow.com/survey/2021#developer-pro... Most people responding have 5 or more years of experience

You’re both right - most people have coded for more than 5, but most people have been coding professionally for 5 or less.

No I'm talking about professionally, 64.33% of respondents have 5 years or more professional experience

Re: A future for SQL on the web

#203

This is incredibly frustrating to read as someone who just spent a week writing logic to dump sql.js queries into json persisted with LocalStorage. Only mad because it’s so much better in every way.

You can’t trust localStorage anyways - it will silently drop some writes in Chrome and Firefox. Some years ago, we used localStorage for queuing writes to the backend and found that concurrent access to localStorage caused data loss - some transactions never came back out of localStorage. One of our engineers wrote a stress test and confirmed the issue. We switched to IndexedDB after that.

Re: A future for SQL on the web

#204

Earlier quoted context omitted.

That’s a fair point, but I’d argue that for cases where the app really needs notifications (for example an alerting system) or when the users want them, building a web app is not actually an alternative even if Apple considers it one.

I don't think Apple considers the web as an alternative platform for apps that are designed to alert you at any time of day for any reason, including when you are not actively using your devices. I think this is a very, very good thing, and doesn't mean that web apps are not a viable alternative to the App Store.

I'm creating a chess pwa that should notify the user when their opponent has moved.

I don't think this web app is going to do as well on Apple devices because of the lack of notifications and also the difficulty to add to home screen.

BTW, you have to give the web app permission to notify. It's not like native apps.

Apple has clearly crippled PWAs to maintain their walled garden.

Re: A future for SQL on the web

#205
post #199

Earlier quoted context omitted.

> Ah yes. But SQlite not having competing independent implementations somehow is? Except that's not why it was culled. The reasons are discussed in great detail on this thread and elsewhere. > non-standards that Chrome pushes (many of which will never get a different implementation because both Safari and Mozilla consider them harmful) are good I'm saying nobody uses those Chrome only APIs, until they become standard…

> I'm saying nobody uses those Chrome only APIs, until they become standards Ah yes. Once Chrome releases something in stable, literally no one ever uses those APIs, no one. And even Google's propaganda machine doesn't tell you to use them (example: https://web.dev/usb/ ) > Or are you against experimentation? I'm not. What Google does isn't experimentation.

My assumption is that a very small percentage of developers participate in it. Feel free to prove me wrong if you have any numbers.

> I'm not. What Google does isn't experimentation.

So the way this is done now (with origin trials to collect feedback from developers) is not good enough? What exactly is your definition of experimentation?

Re: A future for SQL on the web

#206
post #183

Earlier quoted context omitted.

> And yet we're are now at a point where Chrome rams its own APIs through standards bodies, and there are no (and often won't be) any independent competing implementations. Very few people are using Chrome-only APIs which are not in the standards yet. So it's not really a concern. But otherwise, Chrome really has pushed the web forward more than any other browser. If it hadn't, native (and walled garden style) app st…

> Very few people are using Chrome-only APIs which are not in the standards yet. So it's not really a concern. Ah yes. But SQlite not having competing independent implementations somehow is? Also, "not many people using something" is not as great an argument as you think it is. See, for example, the latest problem with browsers deciding to remove alert/prompt/confirm: https://dev.to/richharris/stay-alert-d > The web…

From the first comment below the article:

> The Safari team did quite a lot of work re-styling their alerts and dialogs to be within the context of the webpage, yet phishing and scams that utilize this still run rampant on iOS. Repeated alerts are used to lock up the browser and make it unusable, forcing non-technical users to call a scam telephone number because they think their device was hacked.

A few bad actors ruining it even for totally different usecases.

Re: A future for SQL on the web

#207
This is great to see, and a project I considered attempting myself for a bit. I’m excited to test it out.

@jlongster I have a question about this:

> The backend calls it [Atomics.wait] to wait on the result from the worker and blocks until it’s done.

Does this mean the main (UI) thread is blocked during queries? Or are there more threads, like UI SQLite main SQLite FS backend?

————

At Notion, we’ve used IndexedDB for two purposes: (1) to durably persist a queue of changes to send to our backend, and (2) in the desktop app, to LRU cache the page data we read from the server to accelerate reads. Both of these used localStorage years ago, but we ported to IndexedDB because of data loss on localStorage. Porting was fine for the write queue, but we really noticed the slow when we tried porting the data cache. To get close to the original performance we coalesce reads, and we delay writes to the cache significantly so they can batch more effectively into a single readwrite transaction that we send after the reads for the current page load are complete.

That worked okay, but it was annoying to maintain the IDB cache code because our Android and iOS apps used SQLite for their caches, and it’s so much easier to add new queries using SQL compared to writing IDB iterations - and it’s faster. So we switched to using native SQLite via a bridge to a Node process. Now with absurd-sql, maybe we could bring the same caching logic to browsers.

The thing stopping me is how unreliable we’ve found IndexedDB to be - aside from the optimization work. We notice a lot of bugs in IDB implementations on different browsers. In Safari (especially on iOS) there’s a bunch of spooky issues that have caused stalls or spurious errors, sometimes requiring an app restart before the IDB database can be re-opened. Forget it on Android - weird vendor webview patches mean your storage might get cleared out from under you. On Firefox, we notice that sometimes the IndexedDB database doesn’t create all the object stores we request for some reason. Even on Chrome, IndexedDB can suddenly start refusing writes in the middle of a session with no clear explanation, and on Windows restarting the computer is sometimes the only fix.

If we can share SQLite queries with our native apps then maybe it’s worth wading deeper into these issues… but it really does feel like building on quicksand.

Re: A future for SQL on the web

#208
post #22

Earlier quoted context omitted.

Yeah I think so too. It‘s a cliche by now to say these things go in cycles but they do. If we like this part of the cycle, let‘s ride it and let SQL get hyped, even though its been around forever and never went away.

What gives you the confidence that it's going on circles? I cannot see our industry repeating the mantra that NoSQL solves all our persistence problems ever again. There are use cases for them, but not everything is a good fit and I'm pretty sure we found that out as an industry. I'm sure there are always going to be individuals that will claim that they're better at everything, but that doesn't really mean anything.…

Interesting, you wrote circles but OP wrote cycles, which can be circular, sinuslike, shaped like a sawtooth/ramp-wave (LISPs AI-winter anyone?) or even deformed variations with a bit of randomness or reinforcing patterns in them. Hypecycles and speculation bubbles come to mind.

This reminded me of the writings of a german Philsopher, Heidegger maybe? The proposition was, that development happens in cycles similar to a pendulum swinging while moving upwards. Thesis and Antithesis leading to Synthesis.

Re: A future for SQL on the web

#209

Earlier quoted context omitted.

I think its fine for a web app to be multiple MB. Websites like HN/wikipedia/blogs have no need for an SQL database but if you are loading something like a full IM client, it makes sense to download a few MB to make it stable over all browsers.

Disagreed, this is a dangerous line of thinking that leads to using technologies like gwt, Vaadin, Blazor, Flutter or others that try to turn the browser into something that it's not suited to. Sure, there could be cases where you have absolutely no alternatives to do something really specific, but in those cases I'd first invite you to reconsider whether what you're attempting to do actually needs to be a web app. O…

> why not have it be a native app instead of a bundled browser app, for excellent file size

There are other valid arguments, but "use a native app for smaller file size" specifically doesn't make sense at all - the opposite is true.

While webapps may be larger than simple web pages, they're still far far far smaller than native apps, and using service workers etc, you do only pay the download size for a web app once, just like a native app.

For example: the Twitter Android app is a 21MB download. I just tested loading the Twitter PWA (https://mobile.twitter.com) logged in but with an cleared cache: it's a The native app is _7+ times larger_.

I suspect the same or worse is true for the vast majority of other apps, e.g. Uber on Android is a 50MB download, while m.uber.com (reloaded after login with a cleared cache) gives you the same features with <1MB.

Re: A future for SQL on the web

#210

Earlier quoted context omitted.

The cycles are longer than you're imagining. Relational database folk have been railing against the incursions of one generation of non-relational database type or another since at least the 1980's.

Actually, relational databases are the relative newcomers. The limitations of things like CODASYL were well known to 1960s programmers and Codd's relational model sought to address them. Why the non-relational databases keep getting reinvented has been a bit of a mystery when there is already a rich history of development to look to. I get the feeling a lot of the industry isn't much into history, especially of pre-m…

"Those who fail to learn from history are doomed to repeat it." - Sir Winston Churchill

He is paraphrasing: "Those who cannot remember the past are condemned to repeat it." - George Santayana, The Life of Reason, 1905.

That inspired René Magritte to paint this: https://americanart.si.edu/artwork/those-who-cannot-remember...

Making the connection to events in our lifetime: https://hankeringforhistory.com/those-who-cannot-remember-th...

(edit) Some more reflections on it: https://blog.rtcx.net/remember

Post reply on HN