Subject | Re: [firebird-support] Index for query |
---|---|
Author | Anderson Farias |
Post date | 2011-02-22T19:35:30Z |
Hi,
To use a computed index one must use the very same sintax on where clause, in your case:
SELECT * FROM table
where cast(integer_field as varchar(10)) like '21095%'
--- Em ter, 22/2/11, Claudio Romero <clauslack@...> escreveu:
CREATE INDEX IDX_table_char ON table computed by (cast(integer_field
as varchar(10)));
this query works with PLAN (P_UCM_T INDEX (IDX_TABLE_CHAR))
SELECT * FROM table where cast(CODIGO as varchar(10)) like '21095%'
But this query
SELECT * FROM table where integer_field like '21095%'
Use PLAN NATURAL, how can index this field?
To use a computed index one must use the very same sintax on where clause, in your case:
SELECT * FROM table
where cast(integer_field as varchar(10)) like '21095%'
--- Em ter, 22/2/11, Claudio Romero <clauslack@...> escreveu:
CREATE INDEX IDX_table_char ON table computed by (cast(integer_field
as varchar(10)));
this query works with PLAN (P_UCM_T INDEX (IDX_TABLE_CHAR))
SELECT * FROM table where cast(CODIGO as varchar(10)) like '21095%'
But this query
SELECT * FROM table where integer_field like '21095%'
Use PLAN NATURAL, how can index this field?