# Changelog 2023 08 03

### On-disk support for HNSW indexes with pg\_embedding

Neon's `pg_embedding` extension, which enables graph-based vector similarity search in Postgres using the Hierarchical Navigable Small World (HNSW) algorithm (HNSW), now persists HNSW indexes to disk. In the previous `pg_embedding` version (0.1.0 and earlier), indexes resided in memory.

Additionally, `pg_embedding` now supports cosine and Manhattan distance metrics.

- Cosine distance

  ```sql
  CREATE INDEX ON documents USING hnsw(embedding ann_cos_ops) WITH (dims=3, m=3, efconstruction=5, efsearch=5);
  SELECT id FROM documents ORDER BY embedding <=> array[3,3,3] LIMIT 1;
  ```

- Manhattan distance

  ```sql
  CREATE INDEX ON documents USING hnsw(embedding ann_manhattan_ops) WITH (dims=3, m=3, efconstruction=5, efsearch=5);
  SELECT id FROM documents ORDER BY embedding <~> array[3,3,3] LIMIT 1;
  ```

Also, be sure to check out the new [Neon AI page](/guides/postgres-ai-ai-intro) on our website, and our [docs](/guides/postgres-ai-ai-intro), which include links to new [AI example applications](/guides/postgres-ai-ai-intro#example-applications) built with Neon Serverless Postgres.

## Related pages

- [AI tools for Agents](./ai-agents-on-neon-index.md)
- [APIs & SDKs](./apis-sdks-index.md)
- [Changelog](../changelog.md)
- [Integrating with Neon](./building-on-neon-index.md)
- [Lakebase Postgres](./postgres-index.md)
- [Managed Better Auth](./auth-index.md)
- [More](./more-index.md)
- [Neon AI Gateway](./ai-gateway-index.md)
- [Neon community](./community-index.md)
- [Neon documentation](./neon-docs-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
