Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Is it possible to apply compression on phoenix secondary index ?

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
Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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.

Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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

Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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>"

Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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

Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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

Highlighted

Re: Is it possible to apply compression on phoenix secondary index ?

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.

Don't have an account?
Coming from Hortonworks? Activate your account here