Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to use stored embeddings to generate indexes and query
embeddings using ScaNN, IVF, IVFFlat, and HNSW indexes with AlloyDB for PostgreSQL.
For more information about storing embedding, see
Store vector embeddings.
Before you begin
Before you can start creating indexes, you must complete the following
prerequisites.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eThis page guides you on creating and querying indexes using stored embeddings with \u003ccode\u003eScaNN\u003c/code\u003e, \u003ccode\u003eIVF\u003c/code\u003e, \u003ccode\u003eIVFFlat\u003c/code\u003e, and \u003ccode\u003eHNSW\u003c/code\u003e indexes in AlloyDB for PostgreSQL.\u003c/p\u003e\n"],["\u003cp\u003ePrerequisites include having embedding vectors in an AlloyDB table and installing the \u003ccode\u003evector\u003c/code\u003e extension version \u003ccode\u003e0.5.0\u003c/code\u003e or later.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ealloydb_scann\u003c/code\u003e extension, compatible with PostgreSQL 14 and 15, must also be installed to create \u003ccode\u003eScaNN\u003c/code\u003e indexes.\u003c/p\u003e\n"],["\u003cp\u003eYou can create various index types, such as \u003ccode\u003eScaNN\u003c/code\u003e, \u003ccode\u003eIVF\u003c/code\u003e, \u003ccode\u003eIVFFlat\u003c/code\u003e, and \u003ccode\u003eHNSW\u003c/code\u003e, but remember that index names are shared across the database.\u003c/p\u003e\n"]]],[],null,[]]