hnswlib VS postgres

Compare hnswlib vs postgres and see what are their differences.

hnswlib

Header-only C++/python library for fast approximate nearest neighbors (by nmslib)

postgres

Unmodified Postgres with some useful plugins (by supabase)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
hnswlib postgres
12 15
4,015 1,269
1.5% 1.6%
6.2 9.5
19 days ago 6 days ago
C++ Shell
Apache License 2.0 PostgreSQL License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

hnswlib

Posts with mentions or reviews of hnswlib. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-14.
  • Show HN: A fast HNSW implementation in Rust
    6 projects | news.ycombinator.com | 14 Mar 2024
    How does this compare to hsnwlib - is it faster? https://github.com/nmslib/hnswlib
  • Show HN: Moodflix – a movie recommendation engine based on your mood
    1 project | news.ycombinator.com | 9 Nov 2023
    Last week I released Moodflix (https://moodflix.streamlit.app), a movie recommendation engine based to find movies based on your mood.

    Moodflix was created on top of a movie dataset of 10k movies from The Movie Database. I vectorised the films using Hugging Face's T5 model (https://huggingface.co/docs/transformers/model_doc/t5) using the film's plot synopsis, genres and languages. Then I indexed the vectors using hnswlib (https://github.com/nmslib/hnswlib). LLMs can understand a movie's plot pretty well and distill the similarities between a user's query (mood) to the movie's plot and genres.

    I have got feedback from close friends around linking movies to other review sites like IMDB or Rotten Tomatoes, linking movies to sites to stream the movie and adding movie posters. I would also love to hear from the community what things you like, what you want to see and what things you consider can be improved.

  • Hierarchical Navigable Small Worlds
    2 projects | news.ycombinator.com | 10 Jul 2023
    Actually the "ef" is not epsilon. It is a parameter of the HNSW index: https://github.com/nmslib/hnswlib/blob/master/ALGO_PARAMS.md...
  • Vector Databases 101
    3 projects | /r/datascience | 25 Jun 2023
    If you want to go larger you could still use some simple setup in conjunction with faiss, annoy or hnsw.
  • [P] Compose a vector database
    2 projects | /r/MachineLearning | 13 May 2023
    Many vector databases are using Hnswlib and that is a supported vector index alongside Faiss and Annoy.
  • Faiss: A library for efficient similarity search
    14 projects | news.ycombinator.com | 30 Mar 2023
    hnswlib (https://github.com/nmslib/hnswlib) is a strong alternative to faiss that I have enjoyed using for multiple projects. It is simple and has great performance on CPU.

    After working through several projects that utilized local hnswlib and different databases for text and vector persistence, I integrated hnswlib with sqlite to create an embedded vector search engine that can easily scale up to millions of embeddings. For self-hosted situations of under 10M embeddings and less than insane throughput I think this combo is hard to beat.

    https://github.com/jiggy-ai/hnsqlite

  • Storing OpenAI embeddings in Postgres with pgvector
    9 projects | news.ycombinator.com | 6 Feb 2023
    https://github.com/nmslib/hnswlib

    Used it to index 40M text snippets in the legal domain. Allows incremental adding.

    I love how it just works. You know, doesn’t ANNOY me or makes a FAISS. ;-)

  • Seeking advice on improving NLP search results
    4 projects | /r/LanguageTechnology | 22 Jan 2023
    3000 texts doesn't sound like to many, so may be a brute force cos calculation to find the most similar vector would work. If that's taking too much time, may be look at KNN or ANN modules to speed up finding the most similar vector. I use hsnwlib in knn mode for this. SOrt through about 350,000 vectors in about 30-50 msec.
  • How to Build a Semantic Search Engine in Rust
    3 projects | news.ycombinator.com | 9 Nov 2022
    hnswlib is in cpp and has python bindings (you should be able to make your own for other languages).

    https://github.com/nmslib/hnswlib

  • Anatomy of a txtai index
    4 projects | dev.to | 2 Mar 2022
    embeddings - The embeddings index file. This is an Approximate Nearest Neighbor (ANN) index with either Faiss (default), Hnswlib or Annoy, depending on the settings.

postgres

Posts with mentions or reviews of postgres. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-15.
  • Supabase – General Availability Week
    7 projects | news.ycombinator.com | 15 Apr 2024
    - Now, the connection between our API servers and the database was slow (a few hundred ms per query), so we moved to self-hosting Postgres which was pretty painful. We tried to use https://github.com/supabase/postgres, but the documentation was very lacking and we had to make a bunch of modifications to get it to work. After we got it working, it was pretty smooth though - pretty easy to implement backups, etc.
  • Any comprehensive guide on self hosting ?
    4 projects | /r/Supabase | 1 Jul 2023
  • Vector support in PostgreSQL services to power AI-enabled applications
    3 projects | news.ycombinator.com | 1 Jul 2023
    I think Supabase generally does good work, but I don't think they can be given credit for pgvector, if that's what you're indicating (I might have misread).

    As I understand, Andrew Kane is the principal author of pgvector, and has worked on it for almost two years before Supabase added support for it.

    See also https://github.com/pgvector/pgvector/issues/54 and https://github.com/supabase/postgres/pull/472.

  • Storing OpenAI embeddings in Postgres with pgvector
    9 projects | news.ycombinator.com | 6 Feb 2023
    we merged the pgvector PR about 2 weeks ago (https://github.com/supabase/postgres/pull/472). If you're missing anything for your CLI don't hesitate to reach out and we'll see if we can integrate it into the product (my email is in my profile)

    as an aside, Pinecone looks great

  • Given an ansible playbook, how do I "execute" it on a server?
    5 projects | /r/homelab | 3 May 2022
    One of the things they recommend is separating the PostgreSQL DB from the rest of the stack. And they also provide an ansible playbook to set up a postgres DB: https://github.com/supabase/postgres/blob/625899e687047a9da658f3f8cc6dd91ac9769694/ansible/playbook.yml
  • GraphQL is now available on Supabase
    14 projects | news.ycombinator.com | 29 Mar 2022
    > entire solution from docker

    We PR'd this into our docker-compose today [0]. We're always a bit slammed during Launch Week, so if you spot any problems let use know and we'll patch it up asap.

    The extension is also deployed directly into our PG bundle [1] which is available in docker [2]

    > The Gui for adding roles and tying them to postgres access is very slick with hasura. Is this done manually via SQL commands with supabase?

    I haven't tried Hasura so I don't know if this is a direct comparison. pg_graphql works with Postgres Row Level Security - we provide a GUI for this in our Dashboard, but they are also just native PG Policies, so you can write them in raw SQL

    [0] https://github.com/supabase/supabase/pull/6138/files#diff-41...

    [1] https://github.com/supabase/postgres

    [2] https://hub.docker.com/r/supabase/postgres

  • PG 14 now available in Supabase
    2 projects | /r/PostgreSQL | 29 Nov 2021
    and can also PR if it's something useful for everyone: https://github.com/supabase/postgres
  • GitHub - supabase/postgres: Unmodified Postgres with some useful plugins
    1 project | /r/PostgreSQL | 7 Sep 2021
  • Hacker News top posts: Sep 6, 2021
    5 projects | /r/hackerdigest | 6 Sep 2021
    Show HN: Postgres Docker image with common extensions\ (23 comments)
  • Show HN: Postgres Docker image with common extensions
    5 projects | news.ycombinator.com | 5 Sep 2021
    Hi! I'm one of the contributors to the repo. Just to clarify, our Docker image [0] only contains the latest version of Postgres (13) and the common extensions listed out here [1]. All the other features such as this [2] and this [3] are only available in the AWS EC2 or DO droplet images. We've since updated our README to make that clearer :-)

    You can still connect the DB with a PgBouncer image spun up in another container however. Unfortunately, I can't really recommend you which one since there doesn't seem to be an official Docker image for PgBouncer and I myself have never tried any of the existing ones out there. If you're looking to use PostgREST however, they do have an official Docker image that you can use over here [4].

    [0]: https://hub.docker.com/r/supabase/postgres

    [1]: https://github.com/supabase/postgres#extensions

    [2]: https://github.com/supabase/postgres#enhanced-security

    [3]: https://github.com/supabase/postgres#additional-goodies

    [4]: https://hub.docker.com/r/postgrest/postgrest/

What are some alternatives?

When comparing hnswlib and postgres you can also consider the following projects:

faiss - A library for efficient similarity search and clustering of dense vectors.

postgres-operator - Postgres operator creates and manages PostgreSQL clusters running in Kubernetes

annoy - Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk

qdrant - Qdrant - High-performance, massive-scale Vector Database for the next generation of AI. Also available in the cloud https://cloud.qdrant.io/

DBngin - DB Engine

awesome-vector-search - Collections of vector search related libraries, service and research papers

http-proxy - A full-featured http proxy for node.js

semantic-search-through-wikipedia-with-weaviate - Semantic search through a vectorized Wikipedia (SentenceBERT) with the Weaviate vector search engine

postgres-operator - Production PostgreSQL for Kubernetes, from high availability Postgres clusters to full-scale database-as-a-service.

txtai - 💡 All-in-one open-source embeddings database for semantic search, LLM orchestration and language model workflows

edgedb - A graph-relational database with declarative schema, built-in migration system, and a next-generation query language