diff --git a/notebooks/searching-all-of-wikipedia/notebook.ipynb b/notebooks/searching-all-of-wikipedia/notebook.ipynb index 93e2daaa..7eda4278 100644 --- a/notebooks/searching-all-of-wikipedia/notebook.ipynb +++ b/notebooks/searching-all-of-wikipedia/notebook.ipynb @@ -308,7 +308,7 @@ "source": [ "## Part 3: Building the vector indexes\n", "\n", - "Now, we have all the data in our table `vecs`. Let's go ahead and build our vector index. SingleStore gives us many options for our index with many tunable parameters. We will stick with the IVF indexes with default parameters." + "Now, we have all the data in our table `vecs`. Let's go ahead and build our vector index. SingleStore gives us many options for our index with many tunable parameters. We will stick with the `IVF_PQFS` and `HNSW_FLAT` indexes with default parameters." ] }, { @@ -319,7 +319,7 @@ "outputs": [], "source": [ "%%sql\n", - "alter table vecs add vector index auto (v) INDEX_OPTIONS '{\"index_type\":\"AUTO\"}';" + "alter table vecs add vector index ivf_pqfs (v) INDEX_OPTIONS '{\"index_type\":\"IVF_PQFS\"}';" ] }, { @@ -330,18 +330,7 @@ "outputs": [], "source": [ "%%sql\n", - "alter table vecs add vector index ivf_flat (v) INDEX_OPTIONS '{\"index_type\":\"IVF_FLAT\"}';" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "55de3a82-4e6f-4e8b-9fbd-8f5370fd4145", - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "alter table vecs add vector index ivf_pq (v) INDEX_OPTIONS '{\"index_type\":\"IVF_PQ\"}';" + "alter table vecs add vector index hnsw_flat (v) INDEX_OPTIONS '{\"index_type\":\"HNSW_FLAT\"}';" ] }, { @@ -389,7 +378,7 @@ "-- AUTO index\n", "select paragraph, v <*> @qv as sim\n", "from vecs\n", - "order by sim use index (auto) desc\n", + "order by sim use index (ivf_pqfs) desc\n", "limit 5;" ] }, @@ -406,24 +395,7 @@ "-- IVF_FLAT\n", "select paragraph, v <*> @qv as sim\n", "from vecs\n", - "order by sim use index (ivf_flat) desc\n", - "limit 5;" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "40ea859c-c57a-4624-965f-94a18cd05c90", - "metadata": {}, - "outputs": [], - "source": [ - "%%sql\n", - "set @qv = (select v from vecs where id = 1125899906845489);\n", - "\n", - "-- IVF_PQ\n", - "select paragraph, v <*> @qv as sim\n", - "from vecs\n", - "order by sim use index (ivf_pq) desc\n", + "order by sim use index (hnsw_flat) desc\n", "limit 5;" ] }, @@ -464,7 +436,7 @@ "vs as (\n", " select id, paragraph, v <*> @v_mario as score\n", " from vecs\n", - " order by score use index (auto) desc\n", + " order by score use index (ivf_pqfs) desc\n", " limit 200\n", ")\n", "select vs.id,\n", @@ -567,7 +539,7 @@ " statement = sa.text(\n", " f'''select paragraph, v <*> :query_embedding :> vector(1536) AS similarity\n", " from vecs\n", - " order by similarity use index (auto) desc\n", + " order by similarity use index (ivf_pqfs) desc\n", " limit :limit;'''\n", " )\n", " print(\"Searching for matches...\")\n",