Обсуждение: Complex query optimization

Поиск
Список
Период
Сортировка

Complex query optimization

От
"Yuriy Rusinov"
Дата:
Hello, Colleagues !

I have a table with geographical objects, every object has set of semantic values. Thus we have object-semantic relation one-to-many. Tables structure was

objects
id_object | id_semantic
1               2
1               3
1               4
...
n               n1
n               n2

semantics
id_semantic semantic_value
2                  1.6
3                  4.0
...
n1                'ppp'
...

I have to select objects without semantics from list or if this semantic is set then its has to be satisfy defined condition
e.g.
select id_object from (objects as o inner join semantics as s on (2 not in (select id_semantic from objects as os where os.id_object=o.id_object) ));
List of semantic conditions is not limited, therefore execution time will be arise. What kind of optimization may be applied, for tables and queries ?
Thanks a lot.

--
Best regards,
Sincerely yours,
Yuriy Rusinov