On Tue, Jul 6, 2010 at 2:43 AM, Roman <zo...@oe-it.ru> wrote: > I have a query: > > SELECT d1.ID, d2.ID > FROM DocPrimary d1 > JOIN DocPrimary d2 ON d2.BasedOn=d1.ID > WHERE (d1.ID=234409763) or (d2.ID=234409763) > > i think what QO(Query Optimizer) can make it faster (now it seq scan and on > million records works 7 sec) > > SELECT d1.ID, d2.ID > FROM DocPrimary d1 > JOIN DocPrimary d2 ON d2.BasedOn=d1.ID > WHERE (d2.BasedOn=234409763) or (d2.ID=234409763)
EXPLAIN ANALYZE output for both queries, please? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs