---
title: "Don’t use vector. Use halvec instead and save 50% of your storage cost"
description: "pgvector 0.7's half-precision halfvec type stores embedding components as 16-bit floats instead of 32-bit, cutting table and HNSW index storage nearly in half."
url: "https://swe.quest/articles/don-t-use-vector-use-halvec-instead-and-save-50-of-your-storage-cost-bd6cf6e833bfde8c"
canonical: "https://neon.com/blog/dont-use-vector-use-halvec-instead-and-save-50-of-your-storage-cost"
source: "Neon"
published: "2024-07-31"
difficulty: "medium"
kind: "Research"
reading_minutes: 4
tags: ["vector-search","postgres","performance","rag"]
---

# Don’t use vector. Use halvec instead and save 50% of your storage cost

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-07-31, 4 min read, Research. Original: [https://neon.com/blog/dont-use-vector-use-halvec-instead-and-save-50-of-your-storage-cost](https://neon.com/blog/dont-use-vector-use-halvec-instead-and-save-50-of-your-storage-cost)

## Summary

pgvector 0.7's half-precision halfvec type stores embedding components as 16-bit floats instead of 32-bit, cutting table and HNSW index storage nearly in half. On a 1M-row, 1536-dimension DBpedia dataset on an 8 CPU Neon Postgres instance (HNSW m=32, ef\_construction=256), it also reduced index build time by 23% and prewarming time by 50%, with equivalent query latency and recall. Binary quantization shrinks vectors 32x and speeds index builds, but its recall on 1536-dimension embeddings was too low for production. The recommendation is to prefer halfvec over vector after testing on your own data.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)

## Prerequisites

- vector embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- HNSW indexes
- PostgreSQL extensions ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

pgvector, halfvec, HNSW, Neon, scalar quantization, binary quantization, text-embedding-3-small

## Related posts

- [What's new in pgvector v0.7.0](https://swe.quest/articles/what-s-new-in-pgvector-v0-7-0-faa9e83678b64f22.md): Supabase · 2024-05-02 · Medium · 5 min read · Vector search, PostgreSQL, Performance engineering
  pgvector 0.7.0 adds float16 (halfvec), sparse and bit vector types to exploit redundancy in embeddings and cut memory and storage.
- [20x faster than pgvector: introducing pg\_embedding extension for vector search in Postgres and LangChain](https://swe.quest/articles/20x-faster-than-pgvector-introducing-pg-embedding-extension-for-vector-search-058737fc9388f495.md): Neon · 2023-07-11 · Medium · 7 min read · Vector search, PostgreSQL, Performance engineering
  pg\_embedding brought HNSW graph-based approximate nearest neighbor indexing to Postgres.
- [pgvector v0.5.0: Faster semantic search with HNSW indexes](https://swe.quest/articles/pgvector-v0-5-0-faster-semantic-search-with-hnsw-indexes-d1e5c38ac44f551e.md): Supabase · 2023-09-06 · Medium · 6 min read · Vector search, PostgreSQL, Performance engineering, Algorithms
  pgvector v0.5.0 adds HNSW indexes, which combine skip-list-style layering with navigable small world proximity graphs to do approximate nearest-neighbor search over embeddings.
- [pgvector: Fewer dimensions are better](https://swe.quest/articles/pgvector-fewer-dimensions-are-better-23087227ac0db157.md): Supabase · 2023-08-03 · Medium · 6 min read · Vector search, PostgreSQL, Performance engineering, RAG & retrieval
  Lower-dimensional embedding models can match or beat OpenAI's 1536-dimension text-embedding-ada-002 on the MTEB leaderboard while making pgvector queries much cheaper, since fewer dimensions mean fewer distance computations and smaller indexes that fit in RAM.
- [pgvector 0.6.0: 30x faster with parallel index builds](https://swe.quest/articles/pgvector-0-6-0-30x-faster-with-parallel-index-builds-e5dea50876a1e20f.md): Supabase · 2024-01-30 · Medium · 3 min read · Vector search, PostgreSQL, Performance engineering
  pgvector 0.6.0 adds parallel HNSW index builds, cutting build time for 1M 1536-dimension vectors (dbpedia OpenAI dataset, m=16, ef\_construction=200) from about 1h27m to 9.5 minutes.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
