From: wahajali (@wahajali) <noreply+wahajali@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #653: Table Size Estimate Doesn't Match Actual Size
Date: Thu, 22 Aug 2024 12:05:26 +0000
Message-ID: <gh-pgvector-pgvector-653@github.com> (raw)
I have a table with a single vector(1536) column with 500K rows. According to the size estimation provided in the [documentation](https://github.com/pgvector/pgvector?tab=readme-ov-file#vector-type), the size of the table should add up to:
((4 * 1536 + 8) * 500000) = 3076000000 bytes or ~2.86 GB. However, when I check the table size after insertion using the following command, I get 3978 MB, which is significantly more than the estimation:
```
ann=> SELECT pg_size_pretty(pg_table_size('public.dupe_pg_c')) as table_size;
table_size
------------
3974 MB
(1 row)
```
Following is the table information for reference:
```
ann=> \d dupe_pg_c;
Table "public.dupe_pg_c"
Column | Type | Collation | Nullable | Default
-----------+--------------+-----------+----------+---------
embedding | vector(1536) | | |
ann=> select count(*) from public.dupe_pg_c;
count
--------
500000
(1 row)
```
I did also try moving storage to plain `ALTER TABLE public.dupe_pg_c ALTER COLUMN embedding SET STORAGE PLAIN;` but still got similar results.
I am using pgvector v0.7.3. Is there something I am missing?