Re: Ad Hoc Indexes - Mailing list pgsql-hackers

From Stephen Denne
Subject Re: Ad Hoc Indexes
Date
Msg-id F0238EBA67824444BC1CB4700960CB4804B0BC05@dmpeints002.isotach.com
Whole thread Raw
In response to Re: Ad Hoc Indexes  (Justin <justin@emproshunts.com>)
Responses Re: Ad Hoc Indexes  (Justin <justin@emproshunts.com>)
List pgsql-hackers
Justin wrote:
> Then why are the estimates so far off?

Perhaps a really high correlation between those records where coitem_status = 'O' and those records in your date range.
Theplanner estimates 1 row when restricting by both restrictions, whereas there where 458. The 1 row was probably a
resultof a small % for status='O' multiplied by a small % for the date range. 

> If estimates where correct would it improve the performance that much.

Possibly, but a better performance gain might be obtained by rewriting the query, changing the case expression to
somethingalong the lines of: 

coalesce((select wrkcnt_code || ' Operation Completed :' || cast(wooper_seqnumber as text) from wooper inner join
wrkcnton wrkcnt_id = wooper_wrkcnt_idwhere wooper_rncomplete = true and wooper_wo_id = coitem_order_idorder by
wooper_seqnumberdesc limit 1 
),'No Operation Completed') as LastFinshedOp

regards,
Stephen Denne.

Disclaimer:
At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage. This email with any
attachmentsis confidential and may be subject to legal privilege.  If it is not intended for you please advise by reply
immediately,destroy it and do not copy, disclose or use it in any way. 

__________________________________________________________________ This email has been scanned by the DMZGlobal
BusinessQuality              Electronic Messaging Suite. 
Please see http://www.dmzglobal.com/services/bqem.htm for details.
__________________________________________________________________




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Severe regression in autoconf 2.61
Next
From: Bruce Momjian
Date:
Subject: Re: Severe regression in autoconf 2.61