SQL Help

From: "Mark A(dot) Summers" <msummers(at)irtnet(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: SQL Help
Date: 2001-01-26 19:11:45
Message-ID: 94si8l$mos$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I am having trouble with the following query taking forever:
-----
SELECT * FROM ret108108_00, product
WHERE ret108108_00."isbn" = product."Item1"

AND product."SuperCategory" = '1'
AND product."PublisherCode" = 'ZON'
ORDER BY ret108108_00.qty DESC LIMIT 100
----
The problem is the second AND -- if I take this out it runs fine -- is there
any way to optimize it ? I had a similar problem with just Category so I
created a new field in the product file called FullCat which combined
SuperCategory and Category and thus eliminating the 2nd AND clause -- and
that fixed it -- I just didn't want to do the same thing with Publisher.
Before I tried to index Category, SuperCategory ... nothing seemed to help

Any ideas

Thanks in advance
Mark Summers

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-01-26 19:15:35 Re: Rule not invoked in 7.1
Previous Message Josh Berkus 2001-01-26 19:06:05 Re: Request for change in PL/PGSQL function handler