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

Decades ago, PG wrote that he didn't use a database for Viaweb, and that it seemed odd for web apps to be frontends to databases when desktop apps were not[0]. HN also doesn't use a database.

That's no longer true, with modern desktop and mobile apps often using a database (usually SQLite) because relational data storage and queries turn out to be pretty useful in a wide range of applications.

[0] https://www.paulgraham.com/vwfaq.html



> Decades ago, PG wrote that he didn't use a database for Viaweb, and that it seemed odd for web apps to be frontends to databases when desktop apps were not[0].

After reading the link, I don't think that database means the same thing for everyone.

The vwfaq still mentions loading data from disk, and also mention "start up a process to respond to an HTTP request." This suggests that by "database" they meant a separate server dedicated to persist data, and having to communicate with another server to fetch that data.

Obviously, this leaves SQLite out of this definition of database. Also, if you're loading data from disk already, either you're using a database or you're implementing your own ad-hoc persistence layer. Would you still consider you're using a database if you load data from SQLite at app start?

The problem with this sort of mental model is that it ignores the fact that the whole point of a database is to persist and fetch data in a way that is convenient to you without having to bother about low-level details. Storing data in a database does not mean running a postgres instance somewhere and fetching data over the web. If you store all your data in-memory and have a process that saves snapshots to disk using a log-structured data structure... Congratulations, you just developed your own database.


I was certainly inspired by PG's writing (after all we do use Common Lisp, and it's hard to avoid PG in this space). But I don't think they did things like transaction logs like how bknr.datastore does, which makes the development process a lot more seamless.


I think even SQLite itself wasn't as ubiquitous (edit: it didn't exist) when pg write viaweb. If SQLite wasn't there and my options were basically key value stores, I could as well use filesystem in most cases.

Second, querying the RDBMS has been much simplified in past 20 years. We have all kind of ORMs and row mappers to reduce the boilerplate.

We also got advanced features like FTS which are useful for desktop and mobile apps.

Today it's a good choice to use RDBMS for desktop apps.


> If SQLite wasn't there and my options were basically key value stores

Well, there were "options" other than KV stores - MySQL launched a month before Viaweb (but flakey for a good long while.) Oracle was definitely around (but probably $$$$.) mSQL was being used on the web and reasonably popular by 1995 (cheap! cheerful! not terrible!)

(definitely understand making your own in-memory DB in 1995 though)


> Today it's a good choice to use RDBMS for desktop apps.

Is there an alternative? I haven't seen a "local filesystem is okay as data storage" software in the 21th century.


HN does not use a database?! Can you expand on that? It's very surprising to me.


I think the structure is very simple. It's just a lot of items like your comment is item 41207393 as in https://news.ycombinator.com/item?id=41207393

I think that is just written to disk as something like file41207393 when you click reply.

When the system needs an item it sees if it's cached in memeory and otherwise reads it from disk and I think that is pretty much the whole memory system. Some other stuff like user id that works in the same sort of way.


It just persists its in-memory data structures to disk. Here's the source of an old version; note uses of `diskvar` and `disktable`. A "table" here is just a hashtable.

https://github.com/wting/hackernews/blob/master/news.arc


if pg is still stuck in the 90s lisp, if bet it's just a single process with the site in ram, using make-object-persistent and loading as needed (kinda like python pickle).

that was all the rave for prototypes back then.


probably uses the filesystem as the backing store


Filesystems these days are like dbs


Good luck transactionally writing files to a random FS, but especially without access to native OS APIs.


What do you mean "without access to native OS API's"?

To be able to read and write you need native os apis, aka read() and write() otherwise how do you do it ?


it was a different time. to my knowledge, viaweb was a series of common lisp instances. All states for a user session was held IN MEMORY on the individual machine. I remember reading somewhere that they would be on a call with a user on production and patch bugs in real time while they were on the phone.

The web has gotten bigger and a lot of these practices simply would not fly today. If I was pushing a live fix on our prod machine with the amount of testing doing it live while on the customer is on the phone entails today, a good portion of you would be questioning my sanity.


An important reason that practice wasn't as reckless as it sounds is that early Viaweb was just a page builder. The actual web stores its customers were building were static HTML, so updating a customer's instance while talking to them on the phone only affected that one user's backend.




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

Search: