Subject | Re: [firebird-support] Expression indices (was: Re: Weird... "keysize too big for index") |
---|---|
Author | Martijn Tonies |
Post date | 2005-03-16T09:52:18Z |
Hello Daniel,
optimizer do :-) ... We're not in paradox anymore, Dorothy. ;-)
It will look up the value in the index, then it will lookup the value
in the table to make sure. If I recall correctly.
Perhaps Arno or someone else can reply to this?
do something like:
WHERE substring(mycol, 1, 100) = 'TEST'
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com
> > > > Then again, who needs wide indices if expression indices aresupported.
> > :-)Actually, "you" never use indices. Only the server and the query
> > >
> > > What are ``expression indices''?
> >
> > Indices based on an expression that returns a value instead of being
> > based on column values.
> >
> > I haven't tried it, but imagine something like:
> >
> > create index index_name on table mytable
> > ( upper(mycolumn) )
> >
> > or
> >
> > create index index_name on table mytable
> > ( substring(mycolumn, 1, 100) )
> >
> > So you could, for example, index the first 100 characters of a longish
> > column instead of the full column value.
>
> Ah, thanks for you description.
> This sounds interesting. But how do you actually use those indices?
optimizer do :-) ... We're not in paradox anymore, Dorothy. ;-)
> I mean, they might/will have different content than the original value,Well, the optimizer doesn't trust stored values in indices currently.
> so I guess they'll not automatically be used by the optimizer, will they?
It will look up the value in the index, then it will lookup the value
in the table to make sure. If I recall correctly.
Perhaps Arno or someone else can reply to this?
> Is there some more detailed information available?You might ask in fb-devel. I don't know if you need to
do something like:
WHERE substring(mycol, 1, 100) = 'TEST'
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com