Subject Re: [firebird-support] long field to index
Author Martijn Tonies
Hello,

> I have a long field that I need to browse through and I am thining
> abou tthe possibilites of speeding up the query.
>
> This is a large varchar UNICODE field, that alone is to big to fit
> in index.
>
> Is it possible to index the field partially? like this:
>
> CREATE INDEX IDX_TABLE
> ON TABLE (SUBSTRING(LONG_FIELD FROM 0 FOR 10))

Nope, Firebird doesn't support expression-based indices.

> The initial tests gave me negative on this. (by the way wouldn't
> that be useful? it could help browsing the blobs also)

Yes, I think it's useful.

> The other solution is to create another filed that is computed as
> substring of the first and index this one.

You cannot index COMPUTED BY fields, as they aren't stored.

The one thing you can do, is create a second column and create
triggers to update it. Index that column.


With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com