Skip to main content
ChineduLB
Silver ⭐️⭐️⭐️
Jan 19, 2020 6:39 AM UTC
Solved

get counts of rows meeting different filter criteria from hive

What is the most efficient way to get count of records meeting different search criteria from a Hive table.

1. count all records where column-a = Null

2. count all records where column-b in [1, 3, 5]

3. count all records where column-c = 'xxx'

etc.

there are a couple hundred of these counts, in groups of 3 or 4.

 

 

tsk
tskAnswer
Gold ⭐️
Jan 20, 2020 11:17 AM UTC

@ChineduLB What is your exact Query? You can write count Queries SQL for Hive table. 

 

In general you can refer below articles: 

 

https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/performance-tuning/content/hive_prepare_to_tune_performance.html

 

https://www.qubole.com/blog/5-tips-for-efficient-hive-queries/

 

Thanks,
Tamil Selvan K

1 reply

tsk
Gold ⭐️
tskAnswer
Gold ⭐️
Jan 20, 2020 11:17 AM UTC

@ChineduLB What is your exact Query? You can write count Queries SQL for Hive table. 

 

In general you can refer below articles: 

 

https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.0/performance-tuning/content/hive_prepare_to_tune_performance.html

 

https://www.qubole.com/blog/5-tips-for-efficient-hive-queries/

 

Thanks,
Tamil Selvan K

Translate