Primary key table takes a lot more disk space than duplicate key table with same data

Hi all,

Using Starrocks 3.3.5, when converting two tables from duplicate key to primary key tables, I observe the size of the tables on disk is almost multipied by 3. Is that expected ? I’m using ZSTD compression, does it work too for primary key tables ?

The key is comprised of two columns : a datetime and a varchar(36)

ZSTD works for primary key. It may comes from the primary key index to de-duplication.

Is there a way to see how much disk space do the indexes take ?

You can just

show data from xxx

get the table size

I don’t get it, even a duplicate key table has indexes, why would they be bigger for a primary key table ?

Primary key has a specified index. It’s used to de-duplicate records when ingestion.Primary Key table | StarRocks
Duplicate key just has some sparse index. The storage occupation is small for sparse index.