Prerequisites

  • cmake (>=3.3)
  • gcc
  • g++ (>=11)
  • PostgreSQL 11, 12, 13, 14, 15 or 16
  • Corresponding development package for PostgreSQL (postgresql-server-dev-$version)

Supported platforms

  • Linux
  • Mac

Installation

1

Clone repository from GitHub

git clone --recursive https://github.com/lanterndata/lantern.git
2

Run cmake

cd lantern
mkdir build
cd build
cmake ..
3

Install the extension

make install
Try running with sudo, if you get permissions issues

Test

CREATE EXTENSION lantern;
CREATE TABLE lantern_demo (id SERIAL, v REAL[3]);
INSERT INTO lantern_demo (v) VALUES ('{0, 0, 0}'), ('{0, 1, 0}'), ('{1, 0, 0}');
CREATE INDEX ON lantern_demo USING hnsw(v) WITH (m=4, ef_construction=8);
SET enable_seqscan=off; -- to always use index on scan
SELECT * FROM lantern_demo ORDER BY v <-> ARRAY[1,1,1];