@Ashwin Bhaskarโ :
Z-ordering is a technique to improve the performance of queries that involve filtering and grouping on specific columns in a large distributed database. When a table is z-ordered on a certain column or set of columns, the data is sorted based on the values of those columns, and stored in a way that maximizes the locality of the data on the storage system.
When multiple columns are used for Z-ordering, the effectiveness of the locality drops because the data is sorted based on multiple columns, and it is more difficult to ensure that the data with the same value combinations of those columns is stored together. This means that queries that use only one of the columns specified in the Z-ordering will not be able to take full advantage of the improved locality provided by the Z-ordering.
In your scenario, if you only use the "source" column in your query, then using it as the sole Z-order column will likely provide better performance than using multiple columns. However, if you frequently query on combinations of the "source" and "completedAt" columns, then using both columns in the Z-ordering may still provide a performance benefit. Ultimately, the decision on how to Z-order the columns should be based on the specific usage patterns of the data and the queries being performed.