Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Michael Fuhr
On Fri, Mar 23, 2007 at 02:13:57PM +0100, Henrik Zagerholm wrote: > I'm just amazed that setting the statistics threshold on one column > mad all the difference. IS there any guidelines on what columns I > should change the statistics on? Start by looking for columns involved in simple compari

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Henrik Zagerholm
Never mind my last post regarding the Bitmap heap scan. That is all in order. Now it works perfectly. Went from 30+ seconds to 179ms. =) I'm just amazed that setting the statistics threshold on one column mad all the difference. IS there any guidelines on what columns I should change the s

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Henrik Zagerholm
23 mar 2007 kl. 13:34 skrev Michael Fuhr: On Fri, Mar 23, 2007 at 12:41:58PM +0100, Henrik Zagerholm wrote: 23 mar 2007 kl. 12:33 skrev Michael Fuhr: The row count estimate for fk_filetype_id = 83 is high by an order of magnitude: Bitmap Index Scan on tbl_file_idx6 (cost=0.00..25.65 rows=1

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Alban Hertroys
Henrik Zagerholm wrote: >> Have you run ANALYZE or VACUUM ANALYZE on these tables recently? >> If so then you might try increasing the statistics target for >> tbl_file.fk_filetype_id and perhaps some of the columns in the join >> conditions. > > I did a vacuum full and reindex on all tables. > >

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Michael Fuhr
On Fri, Mar 23, 2007 at 12:41:58PM +0100, Henrik Zagerholm wrote: > 23 mar 2007 kl. 12:33 skrev Michael Fuhr: > >The row count estimate for fk_filetype_id = 83 is high by an order > >of magnitude: > > > >>Bitmap Index Scan on tbl_file_idx6 (cost=0.00..25.65 rows=1251 > >>width=0) (actual time=21.9

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Henrik Zagerholm
23 mar 2007 kl. 12:33 skrev Michael Fuhr: On Fri, Mar 23, 2007 at 11:43:54AM +0100, Henrik Zagerholm wrote: I'm having a hard time understanding why my query is not using my indices when I change a field in the WHERE clause. The row count estimate for fk_filetype_id = 83 is high by an order

Re: [GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Michael Fuhr
On Fri, Mar 23, 2007 at 11:43:54AM +0100, Henrik Zagerholm wrote: > I'm having a hard time understanding why my query is not using my > indices when I change a field in the WHERE clause. The row count estimate for fk_filetype_id = 83 is high by an order of magnitude: > Bitmap Index Scan on tbl_

[GENERAL] Query not using index pgsql 8.2.3

2007-03-23 Thread Henrik Zagerholm
Hello list, I'm having a hard time understanding why my query is not using my indices when I change a field in the WHERE clause. Please could someone shed some light on this. Below is both queries and explain analyze for the different queries. Regards, Henrik QUERY 1. Using WHERE tbl_file_s