Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Error: indexed key of unsupported type or exceeded length: can not create index #1922

Open
iSRIDHARRAO opened this issue Feb 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@iSRIDHARRAO
Copy link

Getting indexed key of unsupported type or exceeded length: can not create index using columns '[userid iudxid time api]'. Max key length is 512 error while creating an index in immudb:1.9DOM.2 container

Used the following python snippet

from immudb import ImmudbClient
client = ImmudbClient("{0}:3322".format(config['immudb_host']))
client.sqlExec("auditingtable(id VARCHAR[128] NOT NULL, userRole VARCHAR[64] NOT NULL,userID VARCHAR[128] NOT NULL,iid VARCHAR[250] NOT NULL,api VARCHAR[128] NOT NULL,method VARCHAR[32] NOT NULL,time INTEGER NOT NULL,iudxID VARCHAR[256] NOT NULL,PRIMARY KEY id)")
client.sqlExec("auditingtable(userID, iudxID, time, api)")

Earlier we used codenotary/immudb:1.4.1 image and deployed immudb, at that time index got created but now when we are using the recently released image ( immudb:1.9DOM.2 ) we are getting the error

@iSRIDHARRAO iSRIDHARRAO added the bug Something isn't working label Feb 8, 2024
@SimoneLazzaris
Copy link
Collaborator

Hi @iSRIDHARRAO
thanks for the bug report.

I believe that you are missing some part of the sql statement, since we can't see the create table part.

Anyway, there is a limit of 512 bytes on key length for indexes. So you can't create an index where the sum of the length of its parts is more than 512 bytes, and I believe that you are just above that.

@iSRIDHARRAO
Copy link
Author

Hi @SimoneLazzaris ,
Sorry for missing some part, the missed part I included below

from immudb import ImmudbClient
client = ImmudbClient("{0}:3322".format(config['immudb_host']))
client.sqlExec("CREATE TABLE auditingtable(id VARCHAR[128] NOT NULL, userRole VARCHAR[64] NOT NULL,userID VARCHAR[128] NOT NULL,iid VARCHAR[250] NOT NULL,api VARCHAR[128] NOT NULL,method VARCHAR[32] NOT NULL,time INTEGER NOT NULL,iudxID VARCHAR[256] NOT NULL,PRIMARY KEY id)")
client.sqlExec("CREATE INDEX ON auditingtable(userID, iudxID, time, api)")

I wanted to know that this limit was added recently or was there before in 1.4 too

@jeroiraz
Copy link
Contributor

Hi @SimoneLazzaris , Sorry for missing some part, the missed part I included below

from immudb import ImmudbClient
client = ImmudbClient("{0}:3322".format(config['immudb_host']))
client.sqlExec("CREATE TABLE auditingtable(id VARCHAR[128] NOT NULL, userRole VARCHAR[64] NOT NULL,userID VARCHAR[128] NOT NULL,iid VARCHAR[250] NOT NULL,api VARCHAR[128] NOT NULL,method VARCHAR[32] NOT NULL,time INTEGER NOT NULL,iudxID VARCHAR[256] NOT NULL,PRIMARY KEY id)")
client.sqlExec("CREATE INDEX ON auditingtable(userID, iudxID, time, api)")

I wanted to know that this limit was added recently or was there before in 1.4 too

Hi @iSRIDHARRAO, the max key length limit was there already. The reason to set a limit is due to performance, the longer the keys the worst the performance you will get reading and writing data.
It's not externally configurable but the size is currently set in a constant https://github.com/codenotary/immudb/blob/65a25a5b71de2522d93ea0c5f5fc585c9a7a9f69/embedded/sql/engine.go#L95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants