Re: [PERFORM] query optimization differs between view and explicit

2004-01-30 Thread Reece Hart
Stephan, Tom- Thanks. I now see that DISTINCT can't be moved within the plan as I thought. This is exactly the thinko that I was hoping someone would expose. I've decided to abandon the DISTINCT clause. The view is more general and sufficiently fast without it, and callers can always add it t

Re: [PERFORM] query optimization differs between view and explicit

2004-01-29 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Thu, 29 Jan 2004, Reece Hart wrote: >> I have a large query which I would like to place in a view. The explicit >> query is sufficiently fast, but the same query as a view is much slower >> and uses a different plan. I would appreciate an explanation o

Re: [PERFORM] query optimization differs between view and explicit

2004-01-29 Thread Stephan Szabo
On Thu, 29 Jan 2004, Reece Hart wrote: > I have a large query which I would like to place in a view. The explicit > query is sufficiently fast, but the same query as a view is much slower > and uses a different plan. I would appreciate an explanation of why this > is, and, more importantly whether

Re: [PERFORM] query optimization differs between view and explicit

2004-01-29 Thread Christopher Kings-Lynne
[EMAIL PROTECTED]> create view v1 as select distinct on (AH.p2gblataln_id) AH.p2gblataln_id,H.pseq_id,min(H.pstart) as "pstart", max(H.pstop) as "pstop",A.ident,(A.ident/Q.len::float*100)::int as "pct_ident", sum(H.pstop-H.pstart+1) as "aln_length",H.genasm_id,H.chr,H.plus_strand,min(H.gstart) as

[PERFORM] query optimization differs between view and explicit query

2004-01-29 Thread Reece Hart
I have a large query which I would like to place in a view. The explicit query is sufficiently fast, but the same query as a view is much slower and uses a different plan. I would appreciate an explanation of why this is, and, more importantly whether/how I might coax the view to use a differen