From: | Vadim Mikheev <vadim(at)krs(dot)ru> |
---|---|
To: | Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] indexes |
Date: | 1999-05-31 08:50:50 |
Message-ID: | 37524D6A.6B8B50E@krs.ru |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Remigiusz Sokolowski wrote:
>
> Hi!
> I try to optimize following query
> SELECT DISTINCT e1.name_ent AS nazwa_grupy
> FROM ent e1, binds b1, ent e2
> WHERE e1.id_ent=b1.id_parent AND b1.id_child=e2.id_ent AND b1.id_links=0
^^^^^^^^^^^^^
> AND e2.name_ent='SERWIS';
>
> Is it possible to get better results? From explain notes it looks, that
> engine uses indexes on ent table, but I can't constrain it to use any
> index on binds table - this causes main problem.
> Or may be query should look in other way?
>
...
> Table = binds2_idx
> +--------------------+----------------------------------+------+
> |Field | Type |Length|
> +--------------------+----------------------------------+------+
> | id_parent | int4 |4 |
> | id_child | int4 |4 |
> | id_links | int4 |4 |
> +--------------------+----------------------------------+------+
Try to create index on binds (id_links, id_parent, id_child)
Vadim
From | Date | Subject | |
---|---|---|---|
Next Message | Remigiusz Sokolowski | 1999-05-31 09:35:05 | Re: [SQL] indexes |
Previous Message | Remigiusz Sokolowski | 1999-05-31 08:42:02 | indexes |