Re: [GENERAL] Join query on 1M row table slow

2004-02-11 Thread Bill Gribble
On Tue, 10 Feb 2004, CSN wrote: > > I have a pretty simple select query that joins a table > (p) with 125K rows with another table (pc) with almost > one million rows: > > select p.* > from product_categories pc > inner join products p > on pc.product_id = p.id > where pc.category_id = $category_

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread CSN
Doh! Yeah, now I remember ;) QUERY 1: => explain analyze select p.* from product_categories pc inner join products p on pc.product_id = p.id where pc.category_id = 1016 order by p.title limit 25 offset 0; QUERY PLAN

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread scott.marlowe
On Tue, 10 Feb 2004, CSN wrote: > > I think that probably improves things (lower cost? - > see my other post): > > explain select p.* from products p where p.id in ( > select product_id from product_categories pc where > pc.category_id = 1016) order by p.title limit 25 > offset 0; >

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread CSN
--- "scott.marlowe" <[EMAIL PROTECTED]> wrote: > On Tue, 10 Feb 2004, CSN wrote: > > > I have a pretty simple select query that joins a > table > > (p) with 125K rows with another table (pc) with > almost > > one million rows: > > > > select p.* > > from product_categories pc > > inner join prod

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread scott.marlowe
On Tue, 10 Feb 2004, CSN wrote: > > 2. Vacuum analyze the tables concerned and post the > > output of EXPLAIN ANALYSE > > with your query. > > => explain analyze; > > results in: > > ERROR: syntax error at or near ";" at character 16 No silly. you do: explain analyze select ... (rest of th

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread scott.marlowe
On Tue, 10 Feb 2004, CSN wrote: > I have a pretty simple select query that joins a table > (p) with 125K rows with another table (pc) with almost > one million rows: > > select p.* > from product_categories pc > inner join products p > on pc.product_id = p.id > where pc.category_id = $category_id

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread CSN
> 2. Vacuum analyze the tables concerned and post the > output of EXPLAIN ANALYSE > with your query. => explain analyze; results in: ERROR: syntax error at or near ";" at character 16 __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. ht

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread Richard Huxton
On Tuesday 10 February 2004 19:51, CSN wrote: > I have a pretty simple select query that joins a table > (p) with 125K rows with another table (pc) with almost > one million rows: > > select p.* > from product_categories pc > inner join products p > on pc.product_id = p.id > where pc.category_id =

Re: [GENERAL] Join query on 1M row table slow

2004-02-10 Thread lists
On Tue, 10 Feb 2004, CSN wrote: > I have a pretty simple select query that joins a table > (p) with 125K rows with another table (pc) with almost > one million rows: > > select p.* > from product_categories pc > inner join products p > on pc.product_id = p.id > where pc.category_id = $category_id