sql - How to create index in firebird for improvement of select query -
i newbie in using firebird. have 3 tables.
for t_table1 structure shown below:
for t_table2 structure shown below:
and t_table3 structure this:
the primary key id t_table1 tbl1_id in t_tabel2 , tbl1_id in t_table3. how can select data join 3 tables , want use index best select query don't know how create index because newbie in using firebird , want learn more in using firebird. hope explanation clear.
the syntax creating index documented in firebird 2.5 language reference, create index, contains additional information.
the syntax creating index is:
create [unique] [asc[ending] | [desc[ending]] index indexname on tablename { (<col> [, <col> ...]) | computed (expression) } <col> ::= column not of type array, blob or computed
so creating (ascending) index on t_tabel2.tbl1_id
do:
create index ix_tabel2_tbl1_id on t_tabel2 (tbl1_id)
but commented earlier today not necessary if there foreign key on column, foreign keys in firebird automatically index (the same applies primary keys).
it not clear question if have foreign keys, i'd advise create them instead of index: gives index , on top of enforces value of tbl1_id
exists in t_table1
.
just keep in mind creating index not automatically improve performance. optimizer example might decide using index not worth effort (or specific index not relevant query).
Comments
Post a Comment