Apache Phoenix gives HBase tables a SQL interface, so application developers can use standard SQL, secondary indexes and views instead of the native API. It suits low-latency application queries, not large analytical scans. Every secondary index costs a write per row change, so add them only for queries you have proven.
Why Phoenix
Cloudera describes Operational Database as powered by HBase and Phoenix. HBase gives real-time random access by key. Phoenix adds ANSI-style SQL, so teams can work in tables, columns and queries. Developers can also keep using HBase's native APIs where they need them, with one firm exception: Cloudera states that changing a Phoenix table through the HBase native API is not supported, and it can cause errors, inconsistent indexes, wrong results or data corruption. Pick one write path per table.
The Apache Phoenix tuning guide sets the expectation. Phoenix and HBase work well for point lookups and small range scans, and if your application needs many full table scans, they are likely not the right tool. Use Parquet-based tools for those reads.
The primary key is the row key
Phoenix joins your primary key columns into the HBase row key, and the guide calls this the single most important factor in performance. You cannot change it later without rewriting the data and index tables. The leading column has the most effect, so lead with the column you filter on most in your most important queries. Every cell carries a copy of the row key, so keep key columns compact. This is why the HBase row-key work in Apache HBase on Cloudera comes first.
Secondary indexes
Without an index, a query on a column that is not part of the row key scans the table. A secondary index lets Phoenix find rows by another column. Phoenix has global and local indexes, and an index can include extra columns so a query is answered from the index alone.
| Index type | Best for | Cost |
|---|---|---|
| Global index | Read-heavy tables, queries on a non-key column | Extra write across servers for each change |
| Local index | Write-heavy tables where the index sits beside the data | Reads may touch more regions |
| Covered index (with included columns) | Queries that need only a few columns | Larger index, more write cost |
| Uncovered index | Wide or rarely read columns that you do not want copied into the index | A server-side join back to the data row at read time |
The Apache documentation adds detail. With a global index, all the performance penalty lands at write time, and at read time Phoenix scans the index like any HBase table. A global index is not used for a query that references a column outside it, unless you use an uncovered index. A local index keeps data and index together on one server, so writes avoid network cost, but every region must be checked at read time. Phoenix also supports functional indexes on expressions, such as UPPER of a name, for case-insensitive search.
-- Covered global index: answers the query from the index alone
CREATE INDEX orders_by_customer ON orders (customer_id, order_date) INCLUDE (status);
-- Local index
CREATE LOCAL INDEX orders_by_status ON orders (status);
-- Check which access path a query uses
EXPLAIN SELECT status FROM orders WHERE customer_id = 'C1001';Confirm index behavior and settings for your Runtime release, including whether uncovered and eventually consistent indexes exist in the Phoenix version you run.
Index consistency and write cost
Phoenix documents that after a successful commit, data is written to the table and all its indexes. What differs is how safe the pair is if a server crashes mid-commit:
- Local indexes are always consistent from Phoenix 4.8 on.
- Global indexes on transactional tables give the strongest guarantee, with atomic commits, at the cost of conflict detection and running a transaction manager.
- For mutable and immutable tables created on current versions, Phoenix uses a three-phase write with a status on index rows, so unverified rows are repaired from the data table at read time.
- For write-heavy tables that can accept a short staleness window, a global index can be created as eventually consistent to move its upkeep off the write path.
If your rows are written once and never updated, such as events, declare the table with IMMUTABLE_ROWS=true to cut write cost. Nothing enforces it, so if the data does change, the index drifts from the table. To build an index on a large existing table, use the ASYNC keyword so a batch job builds it instead of the foreground statement.
Limits
- It is not built for large scans or heavy joins. Move analytics to Impala on Kudu or Iceberg.
- Index maintenance adds write latency.
- Keep a close eye on how rows are salted and keyed, because Phoenix sits on the HBase key design.
- Salted tables return rows in salt order, not natural key order, unless you turn on the row-key ordered setting, which costs a client-side merge.
Salting and hotspots
For monotonically increasing keys, such as a timestamp or sequence, Phoenix can salt the row key with the SALT_BUCKETS table property, from 1 to 256. The tuning guide says to set buckets close to the number of region servers, and not to salt by habit: use salting only when you see hotspotting, because it makes range reads query several buckets. A salted table with no split points is pre-split on salt boundaries.
CREATE TABLE events (
event_id BIGINT NOT NULL,
device_id VARCHAR,
payload VARCHAR,
CONSTRAINT pk PRIMARY KEY (event_id)
) SALT_BUCKETS = 12, IMMUTABLE_ROWS = true;The bucket count above is a placeholder: set yours from the number of region servers on your cluster.
Connecting applications
Cloudera documents two JDBC drivers. The thick driver talks to HBase directly, so the client needs network access to all HBase nodes and the cluster's hbase-site.xml. The thin driver talks to Phoenix Query Server, which needs only access to that server, and it can go direct or through Apache Knox over HTTPS. Users also need Ranger permission for Phoenix and HBase. For apps outside the cluster network, the thin driver is usually the simpler path to approve.
Tuning
- Start from your five most important queries and read their explain plans.
- Add one index at a time and measure the write cost.
- Salt tables with sequential keys to spread load, but only if you see hotspots.
- Keep column families few.
- Declare append-only tables immutable.
- Re-test after upgrades.
Questions we hear
Can Phoenix replace our data warehouse? No. It serves application queries by key and small range. Warehouse scans belong on Impala.
How many indexes is too many? Each index is another table written on every change. Add one only when a proven query needs it.
The storage side is covered in Apache HBase on Cloudera, and the service view on the Operational Database page. For choosing a SQL engine for analytics, see Impala vs Hive.
A first engagement
Duczer East offers a Phoenix query and index review: we take your top queries, read their plans, test each index candidate for write cost and hand back a short list of indexes to add, keep or drop.




