Better HN
topnewbestaskshowjobs
Log inSign up

zombodb

131 karma · joined Jul 20, 2015 (11y ago) · 53 submissions

Submissions

comment 2mo ago · link · parent

> Your only duty is to abide by the license.

We live in a society. I don’t see any harm in believing we ought to be respectful of the work. That’s all I’m saying. You don’t have to be, but it’s a better world if you are.

> If you want to enforce that everything built on top of a particular open source package also be open source, that belongs in the license.

Yes! I fully agree. The one that creates the thing is the one that gets to choose its license.

Having opened-sourced some bit of work myself, that’s a very difficult decision.

comment 2mo ago · link · parent

Over Postgres' FTS, TIN provides at least:

  - superior performance
  - superior operational overhead
  - no second copy of data in tsvector form
  - BM25 scoring support with optimized top-k output
  - runtime configurable scoring knobs
  - expression-attached score boosting
  - sophisticated span query support -- this is proximity search on steroids (https://github.com/planetscale/lead/tree/main/tinql/docs)
  - lossless term positions
  - index-answerable negative expressions (find all docs that don't contain a word)
  - full document hit highlighting
  - optimized exact `count(\*)`
  - term expansion via any of fuzzy matching, wildcards, regular expressions, and dictionary ranges
  - intentionally smaller user-facing SQL API surface
There's a lot we didn't cover in the announcement blog. I'm sure we'll do more as time goes on.

As an aside, something I personally think is cool, and I suppose you can do this with Postgres' built-in `@@` too, is that you can use TIN's full query language (linked above) against any text datum. This is a valid query:

  SELECT pid, query 
  FROM pg_stat_activity 
  WHERE query ==> 'select OR copy'
in other words, you don't need an index at all to use TIN's full query language against any text field in any query.

comment 2mo ago · link · parent

I thought I was clear:

> When one develops using open-source software they have an obligation to follow the licenses.

Obviously what follows from one of those licenses is what you say.

I’m glad we agree!

comment 2mo ago · link · parent

It’s clear that we’re on opposite ends of open-source ideology.

Good luck out there! 2026 is wild times!!

comment 2mo ago · link · parent

When one develops using open-source software they have an obligation to follow the licenses. They also have a moral obligation to be respectful of the work upon which they’re building. And they have a social obligation to help improve that software where they can.

Those that develop on top of open-source have no obligation to give you their work for free.

You’d be surprised as to the amount of open-source contributions TIN drove towards Postgres, LLVM, and pgrx. And you’d be speechless at the amount of upstream work across all sorts of open-source PlanetScale does. Postgres 18.6, for example, is better for you today, in part, because of TIN. You’re welcome.

comment 2mo ago · link · parent

Why don’t you like Postgres’ license? It’s as permissive as a license gets.

comment 2mo ago · link · parent

They also end up with all the infrastructure and processes necessary to keep the external search system in sync, resync/reindex, pkey shipping back to their source of truth in queries, application-side joins and enrichment between both sources. It’s brutal.

Having everything in one place eliminates entire classes of development and especially operational problems.

comment 2mo ago · link · parent

I’m one of TIN’s developers and if you google my username you’ll see I’ve been in this space for a long time.

The answer to your first question is simply: yes

As far as your second question, what customization do you need that you believe TIN or PlanetScale doesn’t provide? These are things we can do, with alacrity.

9.

Tin: A Text INdex for Postgres(planetscale.com ↗)

15 points · by zombodb · 2mo ago · discuss

comment 1y ago · link · parent

Shout out to grapeseed oil

comment 2y ago · link · parent

Yup. Just under a 501c3 to help ensure pgrx outlives us.

Huge thanks to TCDI (www.tcdi.com) for continuing to fund development.

comment 2y ago · link · parent

Y'all have built something cool. I'm excited to see where it goes from here.

If there's anything the pgrx team can do to help, just let us know.

comment 2y ago · link · parent

If you build it, they'll come. The only limit is yourself!

comment 3y ago · link · parent

Nice deck, Ryan! And thanks for the mentions. ;)

comment 3y ago · link · parent

I think maybe what you’re really looking for are the files here: https://github.com/pgcentralfoundation/pgrx/tree/c2eac033856...

Those are the internals we currently expose as unsafe “sys” bindings.

As we/contributors identify more that are desired we add them.

pgrx’ focus is on providing safe wrappers and general interfaces to the Postgres internals, which is the bulk of our work and is what will take many years.

As unsafe bindings go, we could just expose everything, and likely eventually will. There’s just some practical management concerns around doing that without a better namespace organization —- something we’ve been working.

The Postgres sources are not small. They are very complex, inconsistent in places, and often follow patterns that are specific to Postgres and not easy to generalize.

If you’ve never built an extension with pgrx, give it a shot one afternoon. It’s very exciting to see your own code running in your database.

comment 3y ago · link · parent

I don’t think we even expose the TableAM APIs? They are incredibly hard to generate bindings for from the C headers — lots of inline functions and complex #define macros.

We have an ambitious goal with pgrx and it’s going to take many years and countless hours of developer effort to get there.

It can, however, serve as a way for newcomers to gain experience with Postgres internals.

Regarding the TableAM specifically, when we are able to create a safe Rust wrapper around it, that wrapper will be documented.

comment 3y ago · link · parent

Thank you. I’ll pass this on to the team.

comment 3y ago · link · parent

If you’re aware of bugs that fall within plrust’s domain we’d appreciate any and all reports via GitHub!

comment 3y ago · link · parent

Always nice to see pgx being used in the wild! Awesome work.

comment 5y ago · link · parent

I don’t pay any attention to what the cloud providers are doing. I have no control over them so….. eh.

ZDB is still alive and well but I have a real job now too.

comment 5y ago · link · parent

I can definitely reword that if it's confusing.

comment 5y ago · link · parent

> Doing so would require ElasticSearch to reach consensus on every read/write

ZomboDB only requires that ES have a view of its index that's consistent with the active Postgres transaction snapshot. ZDB handles this by ensuring that the ES index is fully refreshed after writes.

This doesn't necessarily make ZDB great for high-update loads, but that's not ZDB's target usage.

> They also claim that transactions will abort if ElasticSearch runs into network trouble...

I had to search my own repo to see where I make this claim. I don't. I do note that network failures between PG & ES will cause the active Postgres xact to abort. On top of that, any error that ES is capable of reporting back to the client will cause the PG xact to abort -- ensuring consistency between the two.

Because the ES index is properly refreshed as it relates to the active Postgres transaction, all of ES' aggregate search functions are capable of providing proper MVCC-correct results, using the parallelism provided by the ES cluster.

I don't have the time to detail everything that ZDB does to project Postgres xact snapshots on top of ES, but the above two points are the easy ones to solve.

comment 5y ago · link · parent

I wonder what the ZomboDB developers are up to now? What great text-search-in-postgres things could they be secretly working on?

comment 6y ago · link · parent

https://github.com/zombodb/pgx/releases/tag/v0.0.7

!boom!

comment 6y ago · link · parent

I'd be inclined to agree.

That said, it'd be easy to prototype with pgx, assuming that compression library exists in the Rust ecosystem too?

comment 6y ago · link · parent

I've noodled the idea of a pl/pg_rust, but the whole "Cargo.toml" and downloading dependencies from the internet seems bad.

I see what you're saying about no_std tho. Could be doable.

comment 6y ago · link · parent

That is interesting.

pgx does a lot of that too, but for only pg10/11/12. And then it post-processes the bindings and builds a "common.rs" for symbols that are identical across versions.

That way you can target all three versions at once, and then you can use Rust's #[cfg(feature=)] directive to opt into support for specific versions.

pgx has also done a little bit of work to mask differences between the three versions so they appear as part of "common.rs" anyways.

I wanted a framework that let me know, at development time, if I was trying to do a thing that isn't supported (or the same) across various PG versions.

comment 6y ago · link · parent

blush

comment 6y ago · link · parent

Sure! Top is Postgres, bottom is pgx, after running each 5 times...

    test=# SELECT count(*) FROM (SELECT generate_series(1, 10000000)) s;
      count   
    ----------
     10000000
    (1 row)

    Time: 399.630 ms
    test=# SELECT count(*) FROM (SELECT srf.generate_series(1, 10000000)) s;
      count   
    ----------
     10000000
    (1 row)

    Time: 478.194 ms

Thanks for the reply. I'm not surprised there's room for optimization in pgx, especially in the Iterator-->SRF path.

edit: PS, thanks for the idea of putting what I assume is the backend pid in psql's prompt. I need to go figure out how to do that right now!

edit edit: hmm, I guess that's not the PID.

comment 6y ago · link · parent

Yes there is. It's not documented/example'd yet tho.

There's a derive macro called #[derive(PostgresType)]. Combine that with serde's Serialize, Deserialize, and you're gtg.

I'm going to be working on more docs and twitch streams over this week.

12