Vector search using SQLite

Alex Garcia wrote the sqlite-vec extension that allows you to perform vector searches in sqlite. Since the extension is written in pure C, it can be run anywhere sqlite is supported. Let's see how it works.

First we need to load the extension. You can download the extension for your platform from the releases page. In my case, I'm using a Mac with an M1 chip, so I'll download the extension like this:

wget https://github.com/asg017/sqlite-vec/releases/download/v0.1.1/sqlite-vec-0.1.1-loadable-macos-aarch64.tar.gz
tar -xzf sqlite-vec-0.1.1-loadable-macos-aarch64.tar.gz
rm sqlite-vec-0.1.1-loadable-macos-aarch64.tar.gz

Now we have vec0.dylib in the current directory. We can load the extension like this:

sqlite3

.load ./vec0.dylib
SELECT column1, column2
FROM
  table_name
WHERE
  condition
GROUP BY
  column1
HAVING aggregate_condition
ORDER BY column2;

Background

The history of rocket launches dates back to ancient China, where gunpowder-filled tubes were used as primitive forms of propulsion.

Fast-forward to the 20th century during the Cold War era, the United States and the Soviet Union embarked on a space race, a competition to innovate and explore beyond Earth.

This led to the launch of the first artificial satellite, Sputnik 1, and the crewed moon landing by Apollo 11. As technology advanced, rocket launches became synonymous with space exploration and satellite deployment.

The Space Shuttle era

Sputnik 1 (1957)

This was the first artificial satellite. Launched by the Soviet Union, it marked the beginning of the space age.