Re: [PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread ismo . tuononen
Hi, how about: select sf.library_id, fio.clip_type , count(sf.sequence_id) fromsequence_fragment sf, fragment_external_info fio ,(SELECT distinct sequence_id from sequence_alignment) sa where sf.seq_frag_id = fio.sequence_frag_id and sf.sequence_id = sa.sequence_id group by s

Re: [PERFORM] Incorrect estimates on columns

2007-10-18 Thread Chris Kratz
On Wednesday 17 October 2007 20:23, Tom Lane wrote: > Chris Kratz <[EMAIL PROTECTED]> writes: > > On Wednesday 17 October 2007 14:49, Tom Lane wrote: > >> Evidently it's not realizing that every row of par will have a join > >> partner, but why not? I suppose a.activityid is unique, and in most >

Re: [PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread John Major
Hi Hekki- When I turn seq_scan off for the new query: explain select sf.library_id, fio.clip_type , count(sf.sequence_id) fromsequence_fragment sf, fragment_external_info fio where sf.seq_frag_id = fio.sequence_frag_id and sf.sequence_id IN (SELECT sequence_id from sequence_alig

Re: [PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread John Major
Hello Nis- I did reset the defaults before running the explain. Primary keys for the tables. sequence_fragment.seq_frag_id sequence.sequence_id Candidate keys. fragment_external_info.seq_frag_id (FK to sequence_fragment.seq_frag_id) sequence_alignment.sequence_id (FK to sequence_fragment.se

Re: [PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread Heikki Linnakangas
John Major wrote: > ~there are indexes on all of the fields being joined (but not on > library_id or clip_type ). ~Everything has been re-analyzed post index > creation > ~I've tried "set enable_seqscan=off" and set (join_table_order or > something) = 1 Seqscanning and sorting a table is generally

Re: [PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread Nis Jørgensen
John Major skrev: > I am trying to join three quite large tables, and the query is > unbearably slow(meaning I can't get results in more than a day of > processing). > I've tried the basic optimizations I understand, and nothing has > improved the execute speed any help with this would be great

[PERFORM] How to improve speed of 3 table join &group (HUGE tables)

2007-10-18 Thread John Major
I am trying to join three quite large tables, and the query is unbearably slow(meaning I can't get results in more than a day of processing). I've tried the basic optimizations I understand, and nothing has improved the execute speed any help with this would be greatly appreciated The th

Re: [PERFORM] Incorrect estimates on columns

2007-10-18 Thread Nis Jørgensen
Chris Kratz skrev: > Hello Everyone, > > I'm struggling to get postgres to run a particular query quickly. It > seems that very early on, the planner seems to mis-estimate the > number of rows returned by a join which causes it to assume that > there is only 1 row as it goes up the tree. It then