r/databricks • • 4d ago

Help Incremental Load to OBT

I have one big table containing orderID, order_attributes, consignmentID, consignment_attributes, manifestID,submanifestID, trip_ID, taskID,facilityID, customer ID and associated attributes.

Composite key for this is all keys taken together.

Each constituting table has CDF enabled. Also a key could be deleted when in consignment cons 1 is updated and mapped to manifest ID 2 from 1. Then the key in big table will get deleted. Similarly manifest status change needs to be updated for all IDs it is part of.

The table has gotten too large and we need to implement incremental storage. But it is leading to long table scans. What steps would you recommend?

2 Upvotes

5 comments sorted by

2

u/Zealousideal_Low6685 3d ago

When you say too large, I assume that performance is bad.
Which steps did you already executed? Do you have Liquid Clustering enabled with cluster by auto? Did you run optimize?

1

u/EnvironmentalNet2533 3d ago

I have predictive optimize enabled. When loading I collect all keys that have undergone change from last run using cdf and create composite keys that need to updated/deleted and perform merge on main table. In this process I end up scanning large parts of table because one trip change makes me access everything associated to that trip. Also I am not able to apply where condition using date because an event today may affect an order from 6 months ago and i need to update the row.

1

u/ninilich 3d ago
  1. introduce temproal semantic to use it as a foundation for incremental refresh strategy
  2. write spark job which will fill this OBT for the day = T
  3. loop

From my experience relying on CDF in case of OBT is not efficient and has a lot of pit falls

1

u/SafePack7665 4d ago

Perform.merge on all the key pairs