12-07-2022 07:55 PM
Hi,
I've large Delta Table for IoT data for over 10K different sensors with timestamp, sensor name and value columns at 1 second precision.
Query pattern is usually random 5-100 sensors at a time. But typically involves specific year/month/day interval.
This table grows with Auto Loader every 4 hours, via appending pre-landing parquet files to Delta Table.
I'm planning to create year, year-month, year-month-day columns and Z-Order by these to improve query time.
My question is, when SQL query is based on using the timestamp column, will it take advantage of Z-Ordering? Or do I have to specify the calculated columns (year, year-month, year-month-day) with a where clause?
12-08-2022 01:55 AM
Hi @Nurettin Ersoz , you have to specify the column you are using for Z-Ordering in the SQL query.
It seems like you want to specify multiple columns for ZORDER BY as a comma-separated list. But the effectiveness of the locality drops with each additional column. So, the performance may not be better.
https://www.youtube.com/watch?v=A1aR1A8OwOU
Above video might help you. Have a look at it.
12-08-2022 01:55 AM
Hi @Nurettin Ersoz , you have to specify the column you are using for Z-Ordering in the SQL query.
It seems like you want to specify multiple columns for ZORDER BY as a comma-separated list. But the effectiveness of the locality drops with each additional column. So, the performance may not be better.
https://www.youtube.com/watch?v=A1aR1A8OwOU
Above video might help you. Have a look at it.
12-08-2022 06:06 AM
Hi @Nurettin Ersoz, We haven’t heard from you since the last response from @Geeta Sai Boddu , and I was checking back to see if her suggestions helped you.
Or else, If you have any solution, please share it with the community, as it can be helpful to others.
Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.
12-08-2022 06:11 AM
Hi,
Thank you this helps!
12-08-2022 06:12 AM
Hi @Nurettin Ersoz, It would mean a lot if you could select the "Best Answer" to help others find the correct answer faster.
This makes that answer appear right after the question, so it's easier to find within a thread.
It also helps us mark the question as answered so we can have more eyes helping others with unanswered questions.
Can I count on you?
07-29-2023 03:31 PM
@numersoz did you z-order on the timestamp column or on less granular columns, like Year, Month, or Day. timestamp column is very granular (high cardinality) since it also includes hour, minute, second...
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.