Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Is it possible to apply compression on phoenix secondary index ?

We are using phoenix layer on top of Hbase table & created hbase tables via phoenix and appied snappy compression . is it possible to apply snappy compression or any compression on phoenix seconday index tables also ? if yes ,could you please share the syntax to use . Thanks .

6 REPLIES 6

Super Guru

@srini

The secondary table is just another table in HBase that you have created. You can compress it using same technique you used to compress your data table.

Thanks @mqureshi . can we add 'snappy compression' with alter phoenix command ? if yes , could please provide the syntax for it . Thanks you .

Super Guru

@srini

I am not sure if you can add that by using Phoenix. But using HBase shell, you can first enable compression for the table and then run "major compact <table name>"

Cloudera Employee

@srini

While creating a new secondary index for a table, we can use the command such as below to specify the compression type:

> create index INDEXNAME on SCHEMA.TABLENAME(COLUMN) COMPRESSION=snappy;

And to alter the compression for an existing index table, run the following command from phoenix (notice that the command is 'alter table' instead of alter index here)

> alter table SCHEMA.INDEXNAME SET COMPRESSION=snappy

Thanks @rmaruthiyodan . Please provide some more clarity for your reply . you have given 'alter table' instead of 'alter index', that is fine . you mentioned SCHEMA.INDEXNAME ,SCHEMA is related to table as i knew , Is it related to index s well ? I dont have ant SCHEMA for the table ,what will bethe default SCHEMA name ? Thanks

Cloudera Employee

@srini Sorry, I missed to notice this question earlier. Yes, the schema is related to an index as well. If no schema is associated with a table then you would just use the table name or index name in the command as:

> alter table INDEXNAME SET COMPRESSION=snappy;

I hope that answers the question.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.