A scenario for a data engineer · Mid level and up
How should the new table be laid out?
Patch · Your teammate
Wednesday, 10:00
You are creating a 50 gigabyte events table in Delta on Databricks. Most queries filter by user id and by date. A colleague suggests partitioning it by user id.
What do you do?
Tap the one you would do. The answer opens below.
Show the best callThe best call
No partitions. Use liquid clustering on user id and date.
Queries skip most of the files, and the clustering columns can be changed later.
Why
Partitioning by a column with many values splinters a table into tiny files. Databricks recommends liquid clustering for new tables, and no partitions for tables under a terabyte.
Read it in the Databricks docs (opens in a new tab)The other two
- Works, at a price. Partition by date.
- Date filters are fast. Filters by user still read every file for the day, and the table is small for partitions.
- A poor call. Partition by user id, as suggested.
- Millions of users means millions of tiny folders and files. Everything gets slower.
The words in this scenario
- Partitioning.
- Splitting a table's files into groups by the value of a column, such as one group per date. A query that filters on that column reads only the groups it needs. In the docs (opens in a new tab)
- Liquid clustering.
- A way to lay out a Delta table so that rows with the same values in chosen columns sit together in its files. It takes the place of partitions, and the columns can be changed later. In the docs (opens in a new tab)
Go deeper on brickster.ai
- Delta Lake: what changed recentlyNews, releases, videos and questions on it, gathered daily.
- Drill Delta Lake in PracticeShort questions with the reason after each answer.
More scenarios
- You need to test a risky change · data engineer
- Which region was this customer in back then? · data engineer
- Six weeks of wrong totals · data engineer
- All 47 scenarios
Had one like this at work? Send it to us: the best tickets come from real incidents.
Checked against the Databricks documentation on . brickster.ai is independent and is not affiliated with Databricks.