Performance of indexing on varchar columns without specific length

classic Classic list List threaded Threaded
2 messages Options
Shravya Nethula Shravya Nethula
Reply | Threaded
Open this post in threaded view
|

Performance of indexing on varchar columns without specific length

Hi, 

A table has two varchar columns, one column created with specific column length and other created without any specific length as shown below:
CREATE TABLE person (id LONG PRIMARY KEY, name VARCHAR(64), last_name VARCHAR)

Can we create index on varchar columns without any specific length? In the above scenario, can we create index on last_name column?
And while creating index on those columns, will there be any performance difference on these columns?


Regards,

Shravya Nethula,

BigData Developer,


Hyderabad.

ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Performance of indexing on varchar columns without specific length

Hello!

The actual VARCHAR lengths means less than you think. Instead, you can supply a correct INLINE_SIZE when creating this index:

By default it's 10, and some of those bytes are used for length, etc.

Regards,
--
Ilya Kasnacheev


пт, 6 нояб. 2020 г. в 21:04, Shravya Nethula <[hidden email]>:
Hi, 

A table has two varchar columns, one column created with specific column length and other created without any specific length as shown below:
CREATE TABLE person (id LONG PRIMARY KEY, name VARCHAR(64), last_name VARCHAR)

Can we create index on varchar columns without any specific length? In the above scenario, can we create index on last_name column?
And while creating index on those columns, will there be any performance difference on these columns?


Regards,

Shravya Nethula,

BigData Developer,


Hyderabad.