Re: index on calculated column
Posted in 1998
On Wed, 17 Jun 1998 14:35:52 -0700, Richard Caldera
<richardc@skechers.com> wrote:
>
>Joseph:
>
>An index is placed on table column(s) to provide faster searching/sorting
>on that table. Having said this, I don't see the possibility of building
>any sort of useful index based on the difference between two column values.
An example:
select ...
from ...
where started - finished = 5
would be much faster if there where an index on started - finished.
The UDO and possibly some of the 8.x engines can do this sort of
thing, but not the standard IDS (from 4.x to 7.x) engines.
> Perhaps you can provide some background and more information on what you
>are trying to do.
>
>If you really do want to build an index based on the difference between two
>column values, one suggestion is to add a third column for the result of
>your calculation and create your index on it.
>
>-- Richard
>
>At 12:58 6/17/98 -0500, Joseph Cullipher wrote:
>>I am trying to create an index on a calculated column but keep getting
>>a syntax error.
>>
>>create temp table t1 (started smallint,finished smallint);
>>create index t1 on t1(started-finished)>>
>>I couldn't find anything in the manuals that say I cannot do this but
>>it still won't let me. Any suggestions on how I can accomplish this task?
>>
>>-------------------------------------------------------------------------
>>Joseph Cullipher <joseph@cannonexpress.com> Standard Disclaimers Apply
>>-------------------------------------------------------------------------
>>
>>
>>
>--
>
>Richard Caldera
>SKECHERS USA, Inc.
>MIS Department
>richardc@skechers.com
>(310) 318-3100 x 1228
Nils Myklebust
NM Data AS
Norway
E-mail: Nils.Myklebust@nmdata.com
FAQ at: http://www.iiug.org/techinfo/faq/faq_top.html
(Now with ODBC info under "Third party products".)