Skip to main content
Bluetruth
Silver ⭐️⭐️
June 16, 2022
Solved

querying partitions in impala

Hi

How can I make Impala  read only required partitions not all partitions

we are using the results from a sql query

 

Regards

Philip

ChethanYM
ChethanYMAnswer
Gold ⭐️
June 23, 2022

Hello @Bluetruth 

 

Have you tried query like below? Here year is a partition it shows the name in the year 2010.

## select name from census where year=2010;

 

If you need data only from partition column use query like below:

## select <col-name> from <table-name>;

 

Regards,

Chethan YM

2 replies

ChethanYM
Gold ⭐️
ChethanYMAnswer
Gold ⭐️
June 23, 2022

Hello @Bluetruth 

 

Have you tried query like below? Here year is a partition it shows the name in the year 2010.

## select name from census where year=2010;

 

If you need data only from partition column use query like below:

## select <col-name> from <table-name>;

 

Regards,

Chethan YM

Translate
Bluetruth
BluetruthAuthor
Silver ⭐️⭐️
June 24, 2022

Hi Chethan

 

Thanks for the reply

as per your examples

 

1. select name from census where year=2010;

This works fine ie it only queries the partition but our problem is when the condition is not a literal

like ='2010'

but when we try to dynamically retrieve the data like your second example

 

We are finding that the query scans the whole table not just the partition - ie takes much longer in larger tables

 

Translate