Hi team, My current primary key count is around 10...
# general
s
Hi team, My current primary key count is around 100 million. Whenever I restart the server, the primary key count increases to around 260 million and then drops back to 100 million. Could you please help me understand why this behavior occurs?
m
Are you using upsert deletes?
Also cc @Kartik Khare
s
Yes, we are deleting the key using the delete key TTL
m
Right, that explains it.
s
What does it explain? I didn’t get it. Could you please explain it?
m
When server restarts, it will start consuming from previous checkpoint, so the keys will come back, but then TTL will delete them again.
s
Previous checkpoint means snapshot or anything else?
m
snapshot
s
Ok, thanks!
Based on this, the max PKs count should be around 130–140 million. However, in this case, the PKs count grows up to 270 million. The PK count in snapshot is shown in the attached screenshot.
added indexes to my table and reloaded the segment, even in this case, the primary key count increased exponentially, leading to server instance failure.
m
You are saying just adding index + calling reload api (no server restart), and still the thr PK count goes up and comes down? What index did you add? This should not happen. cc @Kartik Khare
🤔 1
s
Added these indexes "invertedIndexColumns": ["customer_id", "msisdn"], "bloomFilterColumns": ["msisdn"], "rangeIndexColumns": ["created_on"],
m
I think it might be because reloading will re-read all rows of the segment, so increase PK first during loading, and then TTL
s
This could become a bottleneck. If we create the realtime table with upsert and modify the table configuration midway, it may cause issues
m
Yes, you probably need off heap upsert and snapshots that avoid these problems. Unfortunately, not available in OSS
🥲 1
s
When S3 as tiered storage becomes available? Once it’s available, we’ll remove the key-based approach and insert the data directly, handling everything at query time
m
I am not aware of a plan for that. Also I don’t see how that helps eliminate upsert
k
@Shubham Kumar mayank is right, meanwhile you can use https://docs.pinot.apache.org/manage-data/data-import/upsert-and-dedup/segment-compaction-on-upserts to remove the already upserted/deleted primary keys on periodic basis
s
After compaction, the PK isn’t growing much now after segment reload. Thanks, @Kartik Khare and @Mayank.
m
Cool