Complex query optimization

From: "Yuriy Rusinov" <yrusinov(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Complex query optimization
Date: 2008-02-01 14:36:23
Message-ID: 1ac023f40802010636q34589b60vd0b8d0cb784606ea@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2008-02-01 14:40:41 pg_restore fails for postgis data dump
Previous Message Colin Wetherbee 2008-02-01 14:22:26 Re: arrays of floating point numbers / linear algebra operations into the DB