Forum: Building VoltDB Applications

Post: Hashable columns for exact match only lookups?

Hashable columns for exact match only lookups?
karlh
Feb 8, 2012
Hi,

I am trying to create a hashed index, as it will always be an exact match. I cannot seem to hash on the varchar type.

CREATE TABLE SESSIONS_IDX_TB
(KEY_NAME VARCHAR(255)
,KEY_VALUE VARCHAR(255)
,NAME_VALUE_HASH VARCHAR(555) NOT NULL
,SESSION_ID VARCHAR(255) NOT NULL
,SUB_ID VARCHAR(255) NOT NULL
);

-- Adding indexes to support the "index lookup"
-- Using a hash index here.
-- Lookups are always exact match lookups CREATE INDEX SESSIONS_IDXTB_IDX_HASH ON SESSIONS_IDX_TB
(NAME_VALUE_HASH);


When I try to compile, I get the following error.

------------------------------------------
Project compilation failed. See log for errors.
------------------------------------------
ERROR 19:31:09,728 [main] COMPILER: [project.xml]: Index SESSIONS_IDXTB_IDX_HASH in table SESSIONS_IDX_TB uses a non-hashable columnNAME_VALUE_HASH
ERROR 19:31:09,728 [main] COMPILER: Failed to compile XML
ERROR 19:31:09,728 [main] COMPILER: Index SESSIONS_IDXTB_IDX_HASH in table SESSIONS_IDX_TB uses a non-hashable columnNAME_VALUE_HASH
ERROR 19:31:09,728 [main] COMPILER: Catalog compilation failed.


Any idea why can't I create string based hash indexes?
Hi, There was a bug with
aweisberg
Feb 8, 2012
Hi,

There was a bug with varchar keys in hash indexes so we disabled them and haven't revisited it yet. We are actually thinking of removing hash indexes for several reasons. I would stick with tree indexes. They use less memory, don't have pauses while doubling/shrinking, and are more likely to result in deterministic execution.

-Ariel
Thats fine, I had temporarily
karlh
Feb 9, 2012
Thats fine, I had temporarily modified the DDL to not use hashes to get past the problem, sounds like they can stay like that.

Regards,
Karl.