‹ BackHN Continuity

Thread

RIP, vector database

397 points · 116 comments · razin

  1. gopalv · · focus · HN ↗
    > This write amplification is large enough that our efforts to tune indexing throughput have started to hit diminishing returns.

    > don't key on the ANN address. That is precisely the change turbopuffer v3 makes. As you can imagine, it is not a trivial change.

    This is a direct parallel to how Postgres and Mysql built indexes.

    Your design choice went from a Postgres design pattern to a Mysql one. The difference is the reindexing cost vs the lookup cost - Postgres optimized for lookup and Mysql does for indexing on writes. Or more accurately, Postgres was better with good schema design using joins & mysql was optimized for a bad design with less normalization where many indexes exist for the same table.

    Postgres always points an index to a row-id within postgres which is an arbitrary value which changes on each update.

    Mysql, always assuming the storage engine is pluggable, points to the primary index entry and adds an extra indirection to the lookup.

    This means that you point the mysql index to a stable id, so unless you go update the primary key for a row, you won't have to update the indexes for all the attribute lookups you might have made to data.

    I don't do databases any more that much, but the design for NIMBLE file format has a lot of quirks which are relevant to this specific idea (wide tables).

    But the old Uber post about switching from Postgres to Mysql to prevent index amplification[1] is a direct mirror to this post.

    [1] - <a href="https:&#x2F;&#x2F;www.uber.com&#x2F;us&#x2F;en&#x2F;blog&#x2F;postgres-to-mysql-migration&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.uber.com&#x2F;us&#x2F;en&#x2F;blog&#x2F;postgres-to-mysql-migration&#x2F;

    1. phoghed · · focus · HN ↗
      &gt; mysql was optimized for a bad design

      TIL I should have been using mysql the whole time

      1. woadwarrior01 · · focus · HN ↗
        Richard Gabriel&#x27;s &quot;Worse is better&quot; vibes.
        1. __s · · focus · HN ↗
          I literally had opening slide about Worse is Better when adding mysql support to peerdb. Lots of things in mysql have v1 as stupidest thing that works, then v2 fixes issues

          There&#x27;s a bunch of internal types like decimal vs newdecimal, binlog started out statement based until they realized uuid generation is random so added data replication on top. CDC offset started as filepos before GTID was made so offset could survive failover

          There were aspects of the design I appreciated (logical slots in postgres have a bunch of drawbacks avoided by just appending to 2nd serial log which has an expiry date instead of tracking clients&#x27; offsets), but developing against protocol you learn to not try build a consistent mental model

        2. nixon_why69 · · focus · HN ↗
          MySQL had worse-is-better dominance over postgres until, like, 2016 or so? I&#x27;ll take the worse solution with better performance and a better replication story any day.
          1. jgalt212 · · focus · HN ↗
            I hear you, but there&#x27;s just so many knobs on postgres that at our correct scale we couldn&#x27;t amortize the time and effort to become proficient at postges.
      2. j45 · · focus · HN ↗
        MySQL was often just much easier to start with for a greater number of people for the average complexity and need for the vast majority of projects.

        This in no way made Postgres any less amazing and cool quietly all those years - if anything it&#x27;s what really let it step into the forefront the past few years.

        As someone who has worked with more than a few databases and MySQL a lot, I&#x27;m quietly content learning and beginning with postgres every chance I can get now, to see where and how long &quot;Postgres for everything&quot; can work in a project, simply from there being fewer pieces to build, maintain, integrate, and let the bottlenecks reveal themselves instead of prematurely optimizing for them.

    2. FLeXMurphy · · focus · HN ↗
      I find it amusing people started quoting LLM output and are responding to it. Hopefully the original authors end up having the LLM respond back.
      1. 0c3ca83 · · focus · HN ↗
        Many of the commenters on this site are also obviously LLMs. I&#x27;d imagine that quite a few of the entities quoting aren&#x27;t necessarily people. Keep an eye on where they slide mentions of other products that a marketing team would like to promote.
        1. FLeXMurphy · · focus · HN ↗
          Personally I haven&#x27;t seen it too often; the other aspect is that HN is a forum for startups to pitch shit to each other, so this has been happening with or without marketers (f.e. &quot;i&#x27;m working on a similar thing&quot;).

          That LLMs are taking over the comments section is something that was already flagged, and Lobste.rs and others have started solving it by having gated registrations. HN should do this but it is unlikely to until it is too late.

          1. senderista · · focus · HN ↗
            lobste.rs has always been invite-only.
          2. awesome_dude · · focus · HN ↗
            Sorry, how does a gated registration stop someone creating an account, then handing it over to an LLM?

            Serious question, am I misreading what&#x27;s being said?

            1. lukan · · focus · HN ↗
              It stops the automation part. One LLM spammer can be dealt with.
              1. unglaublich · · focus · HN ↗
                One can focus on generating 10 other accounts before it&#x27;s flagged. Now you have 10 others to deal with.
                1. lukan · · focus · HN ↗
                  But that does not work on lobsters (or anywhere else with gated registration), because you cannot just create 10 accounts. You can create 1 account after 1 invite. If you abuse, you loose the invite (and maybe the person inviting you the right to invite others).
                  1. awesome_dude · · focus · HN ↗
                    I think, if i have understood the answers correctly that it&#x27;s stopping a quick proliferation - but not a long slow infiltration?
                    1. leviathant · · focus · HN ↗
                      The spam bots I regularly deal with on reddit are using accounts that are several years old. I&#x27;m not sure if they are hacked, purchased, or something else.
          3. alfiedotwtf · · focus · HN ↗
            I don’t get it though… what’s the point of using an LLM just to comment here? Like what does it gain the person doing it
            1. 0c3ca83 · · focus · HN ↗
              Marketing and influcence.

              For example, consider this prompt -- &quot;Find topics that would be relevant to people interested in &lt;company&gt; and post a topical post that mentions &lt;product&gt;&quot;.

              Also, influencing public opinion on certain topics, such as Israel or Palestine, the current administration, the democrats, the various wars that are ongoing, or AI itself.

            2. porkshoe · · focus · HN ↗
              Some bots are trying to influence conversations on some topic, and they comment on neutral topics to build up karma or whatever.

              Also, some people are weirdos.

              1. qlte · · focus · HN ↗
                Disproportionate number of the &quot;weirdos&quot; category on this particular site vs astroturf marketing bots on Reddit&#x2F;etc.

                I&#x27;ve lost count of how many times I&#x27;ve clicked into a bio from a flagged, obviously LLM written comment to find some variation of &quot;Building new AI tools for agentic devops&quot;...

            3. mikestew · · focus · HN ↗
              There are HN accounts that have been shadow-banned for years, and yet they keep posting despite few people ever seeing their posts. They&#x27;re not LLMs AFAICT, but they just keep posting into the void.

              So why use an LLM for commenting? See above, people are weird.

            4. rapidaneurism · · focus · HN ↗
              Steelmaning it: perhaps people who cannot write to save their life are tired of grammar Nazis correcting them? (Admittedly since the llms I have noticed less and less people being pedantic about these things, perhaps it is like the ill fitting cupboard door signaling that this is handmade)
            5. friendzis · · focus · HN ↗
              &gt; Like what does it gain the person doing it

              Time &#x2F; quantity.

              Pre-LLMs you needed a whole &quot;marketing&quot; agency to astroturf on a meaningful scale. Post-LLMs a single person can run multiple astroturfing campaigns in parallel.

            6. somat · · focus · HN ↗
              LLM&#x27;s when leaned on too heavily, have a tendency to destroy critical thought, or perhaps more accurately replace it.

              It is similar to a spell checker, while spell checkers improve spelling in general, they do not improve a persons spelling ability. Instead acting as a crutch. No need to spell well when the machine will do it for you.

              Some people really like expanding their thoughts via LLM prompt. Some so much it acts like a big crutch, no need to think coherently, the machine will do it for you. So they use the LLM for everything.

              As a related tangent something is messed up in my web browser spell checker, it gives the red squiggles indicating a misspelling, but refuses to give suggested corrections. I would fix it but... My spelling ability has never been better than it is right now.

            7. james_marks · · focus · HN ↗
              Build up karma to expand the reach of future promotional posts.
        2. Culonavirus · · focus · HN ↗
          How do you prove you&#x27;re not an llm? The only thing that would work is to add sexist and racist terms lmao.
          1. [deleted] · · focus · HN ↗

            [deleted]

          2. matwood · · focus · HN ↗
            &gt; How do you prove you&#x27;re not an llm?

            I feel like we&#x27;ve already reached the point where HN users have discovered 100 of the last 5 LLM commenters. It&#x27;s the new way to disagree by not having to engage with the argument at all. Just say that a certain sentence structure or word means it&#x27;s an LLM and move on.

            1. FLeXMurphy · · focus · HN ↗
              One of the things HN has been missing for a very long time is an etiquette policy around this very thing. Accusing people of being &quot;russian bots&quot; and such is downright poorly mannered, and dang&#x27;s policy of &quot;less is more&quot; succumbs to mob mentality. The proliferation of mob mentality is one of the things that has eroded the quality of HN over the last... I want to say 10 years, but it might be going too far back.

              However, such a policy requires enforcing otherwise its like the rest of guidelines - vapid shit. Maybe now that HN is infused with LLM-Powered Moderation™, dang can do a bit better.

    3. malisper · · focus · HN ↗
      &gt; Your design choice went from a Postgres design pattern to a Mysql one. The difference is the reindexing cost vs the lookup cost - Postgres optimized for lookup and Mysql does for indexing on writes. Or more accurately, Postgres was better with good schema design using joins &amp; mysql was optimized for a bad design with less normalization where many indexes exist for the same table

      You are right that MySQL does better when you have lots of indexes, but I don&#x27;t think the tradeoff is that the overall Postgres architecture is better with good schema design.

      Having secondary indexes point the primary key enables things like undo logging, which obviates the need for vacuums - vacuums being the most painful part of Postgres. On top of that your primary key index will be mostly cached so the cost of the indirection is much smaller than it may first appear

      1. tomnipotent · · focus · HN ↗
        I think OP is just alluding to the fact that Postgres needs to do less work to go from secondary index to table data, since the tid is a direct pointer to the exact page and slotted entry while MySQL needs a b-tree walk.

        &gt; primary key index will be mostly cached so the cost of the indirection is much smaller than it may first appear

        Not sure I follow. If it&#x27;s in-memory you save having to read from disk, but you still have to walk the b-tree to go from PK to data.

        1. barrkel · · focus · HN ↗
          MySQL was generally (pre 8) optimized for point queries on primary keys. So rows are stored in the PK index, the PK index is a clustered index. Everything more or less falls out of this.
          1. sroussey · · focus · HN ↗
            Around v2 myisam was not a clustered index. It changed with innodb.
            1. barrkel · · focus · HN ↗
              Sure, I&#x27;m only taking about innodb. The join strategies supported before 8.0 (5.7 and lower) were basically nested loop and that&#x27;s it. Which only really works well for a couple of query patterns: point queries with a handful of joined tables all using indexed FKs, or a big sorted scan over one single table and everything joined to it, with pagination through where clause and sorting all on the primary key, and possibly a straight_join to make sure it doesn&#x27;t start the execution plan anywhere other than the spine table.
              1. tomnipotent · · focus · HN ↗
                &gt; only really works well for a couple of query patterns

                To be fair this probably covered probably 9x% of production queries, like high-selectivity index-covered filters and sorts (with a limit). Even today most planners will still use an inner loop.

                It&#x27;s been interesting to watch how different planners have evolved over the years. SQL Server 7 in 1998 launched with features that MySQL and Postgres wouldn&#x27;t catch up to until the late 2010s, but they had other features and quality-of-life improvements that made these edge-case optimizations hardly noticable.

        2. malisper · · focus · HN ↗
          &gt; I think OP is just alluding to the fact that Postgres needs to do less work to go from secondary index to table data, since the tid is a direct pointer to the exact page and slotted entry while MySQL needs a b-tree walk.

          Yes, this is true, but they framed this as &quot;the Postgres approach is better when you have a good schema design&quot;, but that&#x27;s not true. There are plenty of ways the MySQL approach is better even when you have a really good schema.

          &gt; Not sure I follow. If it&#x27;s in-memory you save having to read from disk, but you still have to walk the b-tree to go from PK to data.

          The point I was trying to make is that going to disk is going to be orders of magnitude slower than doing an in-memory B-tree traversal. Because of that, the cost of doing an extra b-tree traversal to find the page you&#x27;re looking for is a relatively small cost compared to reading the page in the first place

      2. throwaway7783 · · focus · HN ↗
        .. and undo logs make rollbacks and crash recoveries slower. It&#x27;s a trade off. MySQL storage engine architecture is nice, postgresql extension mechanism is nice.. and so on.
      3. mattashii · · focus · HN ↗
        &gt; Having secondary indexes point the primary key enables things like undo logging

        That&#x27;s neither here nor there. Heap-oriented tables can have undo logging, too; and index-oriented tables don&#x27;t strictly require undo logging.

        It&#x27;s just that you&#x27;re much more likely to want something like undo logging for index-oriented tables, because maintaining uniqueness for rows that are not in-place updated in the index becomes very expensive as more and more versions of the same key value may need to be checked for visibility and liveness, and removing old deleted versions becomes a maintenance hassle, too. It can be done without undo logging, but apparently that wasn&#x27;t a sufficiently robust (or performant) design.

    4. SigmundA · · focus · HN ↗
      MSSQL (Clustered Indexes) and Oracle (Index Organized Tables) among others let you chose because there are advantages and disadvantages for different situations.

      Not having true clustered indexes in PG is something I miss coming from MSSQL, it helps performance when the majority of access is always primary index avoid indirection from index lookup then tuple lookup and it also saves space if its the only index.

      1. Derekcai · · focus · HN ↗
        I feel the same way.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.