Earlier quoted context omitted.
It’s not quite the same thing but nearby: I built a EAV secondary index system on top of Postgres to accelerate Notion’s user-defined-schema “Databases” feature about a year ago. By secondary index, I mean the EAV table was used for queries that returned IDs, and we hydrated the full objects from another store. We’d heard that “EAV in Postgres is bad” but wanted to find out for ourselves. Our strategy was to push the…
Does postgres not have the ability to hint or force indexes? Long long time ago, I found that quite helpful with MySQL.
Show HN: InstantDB – A Modern Firebase
271–280 of 308 posts
Re: Show HN: InstantDB – A Modern Firebase
#272Earlier quoted context omitted.
Thanks for the response. 2 questions. How hard is it to swap our firebase for instant? I've had an amazing time with firebase, but I sorta want to switch to using a completely local solution. I have a small lyric video generator, and while I don't care about my own songs potentially leaking, I would never want to take responsibility for something else's data. I basically use firebase for the lyrics afterwards I trans…
Glad I could be helpful. > How hard is it to swap our firebase for instant? I've had an amazing time with firebase, but I sorta want to switch to using a completely local solution. It should be relatively straightforward to switch. If you have any questions, you could always reach to us on Discord [1] The only caveat though: Instant is like Firebase; it is not a completely local solution. If you are worried about exp…
Thank you for your help. I'll definitely look into this for my next project
Re: Show HN: InstantDB – A Modern Firebase
#273The datalog syntax has me curious. It looks like a JavaScript "port" of Datomic's Datalog syntax. Have you considered using other forms of Datalog that are seemingly more compatible with JavaScript? See https://en.wikipedia.org/wiki/Datalog?useskin=vector#Syntax I wouldn't mind using the Datalog syntax as-is since I have some experience using Clojure with Datomic, but it did surprise that someone would decide to use…
> but it did surprise that someone would decide to use this syntax over a syntax used in other Datalog engines (and predating Datomic itself). We are clojure programmers, so our introduction to Datalog was actually though Datomic in 2014. We are fans of other query syntaxes (SparQL looks cool too), but we find Datomic's flavor the most ergonomic for us, and it's an added win for us that we can express queries as plai…
I noticed Postgres is used as the storage layer for Instant's triple store. I'm still curious why making a custom triple store over using e.g. XTDB v1. Like Instant's data store, XTDB is schemaless, and it features a Datalog engine capable of basic query planning. For instance, the order of where clauses doesn't negatively impact performance, unlike Datomic. What were the show stoppers in adopting solution like XTDB?
Re: Show HN: InstantDB – A Modern Firebase
#274Re: Show HN: InstantDB – A Modern Firebase
#275I‘m wondering how this compares to convex ( https://www.convex.dev/ )
Re: Show HN: InstantDB – A Modern Firebase
#276How do you prevent the user from uploading a 5gb string to one of the fields?
Re: Show HN: InstantDB – A Modern Firebase
#277If it's offline where the data is stored? IndexDB?
Re: Show HN: InstantDB – A Modern Firebase
#278Earlier quoted context omitted.
Maybe a dumb question, but why do I have to wrap in `db.transact` and `tx.*`? Why can't I just have a proxy object that handles that stuff under the hood? Naively, it seems more verbose than necessary. Also, I like that in Rails, there are ways to mutate just in memory, and then ways to push the change to DB. I can just assign, and then changes are only pushed when I call `save()`. Or if I want to do it all-in-one, I…
This is a great question. We are working on a more concise transaction API, and are still in the design phase. Writing a `user.save()` could be a good idea, but it opens up a question about how to do transactions. For example, saving _both_ user and post together). I could see a variant where we return proxied objects from `useQuery`. What would your ideal API look like?
1. Assign, then save. AFAIK, this is effectively transactional if you're saving a single object, since it's a single `UPDATE` statement in sql. If you assigned to a related object, you need to save that separately.
2. Use ActiveRecord functions like `post.update({title: "foo", content: "Lorem ipsum"})`. This assigns to the in-memory object and also kicks off a request to the DB. This is basically syntax sugar over assigning and then calling `save()`, but addresses the issue around devs forgetting to call `save()` after assigning. In Rails, this is used in 90% of cases.
3. I can also choose to wrap mutations in a transaction if I'm mutating multiple proxy objects, and I need them to succeed/fail as a group. This is rarely used, but sometimes necessary. For example, in Rails, I can write something along the lines of this:
```rb
ActiveRecord.transaction do
post.title = "Foo"
post.author.name = "John Smith"
post.save()
post.author.save()
end# Alternatively, using the `update()` syntax
ActiveRecord.transaction do
post.update({ title: "Foo" })
post.author.update( { name: "John Smith" })
end```
This gives transactional semantics around anything happening inside of the `do` block. I think the syntax would look very similar in javascript, for example:
```js
transaction(() => {
post.update({ title: "Foo" })
post.author.update( { name: "John Smith" })
})```
Re: Show HN: InstantDB – A Modern Firebase
#279If it's offline where the data is stored? IndexDB?
I saw in the docs that it uses IndexDB. Didn’t read carefully to understand how full is the replica and if it’s possible to make 100% offline app and what would be the limits of storage in the browser. Also it would be nice to clarify memory consumption. In general I’m glad such thing now exists!
You could theoretically make a 'fetch all' query, and replicate a completely offline experience. However, Instant is designed for hybrid use cases.
> what would be the limits of storage in the browser.
The limits are set by IndexedDB, which are a bit esoteric (it depends on how much space the user has available on their hard drive). It could reach into the GBs, but then the browser can sometimes choose to delete it. This comment goes more into it: https://news.ycombinator.com/item?id=28158407
Re: Show HN: InstantDB – A Modern Firebase
#280Congrats! BTW, we found a few typos on the site that you might want to fix: https://triplechecker.com/s/yyNfc1/instantdb.com?v=wh8Jr