Skip to content

Ability to specify length for index segments to be indexed on char-based columns [CORE2201] #2629

Description

@firebird-automations

Submitted by: Martijn Tonies (martijntonies)

Votes: 2

When you have the ability to specify the length to be indexed for index segments, you can index very large char-based columns, yet not completely. Nevertheless, the index would help speeding things up when there's plenty of searches in the WHERE clause for smaller strings.

Example syntax (taken from MySQL);
CREATE [UNIQUE] INDEX index_name
[index_type]
ON tbl_name (index_col_name,...)
[index_type]

index_col_name:
col_name [(length)] [ASC | DESC]

Obviously, when you specify the length, it cannot be a unique index.

The difference between this index and an expression based index (eg: SUBSTRING(1, 10) to index the first 10 chars), is that with this index you don't have to use the same expression in the WHERE clause. For large char-based columns that cannot be indexed (eg: 10000 chars), this can help speeding queries up because it can actually use the data that exists in the table (and index).

RDB$INDEX_SEGMENTS should have the specified length for the segment and NULL otherwise? :-)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions