Words
85
Reading
1 min
Listen
Play
1y
Interesting post. Glad to see you enjoy playing with HiveSQL.
Here are a few tips to improve your queries performance:
WHERE parent_author = '' -- Selecting only post not comments
Use thedepthcolumn instead of parent_author to distinguish a post from a comment. It is indexed and processing is way faster than string comparison.
depth = 0 -> post
depth > 0 -> commentWITH (NOLOCK)
Useless. It is managed at the server levelCAST(timestamp AS DATE) = '2025-03-14'
This type of CAST is useless and will be managed by implicit type conversion
->timestamp = '2025-03-14'works perfectly and makes your query more readable
RE: HiveSQL - Querying Json_metadata with App = "Ecency" - Figuring Out Active Users Number by Post & Comment Numbers....