Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B1B5B9FB7D9 for ; Mon, 16 Jul 2007 16:59:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 13968-07 for ; Mon, 16 Jul 2007 16:58:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.autorevenue.com (ip-208.178.167.106.gblx.net [208.178.167.106]) by postgresql.org (Postfix) with ESMTP id 93F4B9FB1E5 for ; Mon, 16 Jul 2007 16:59:11 -0300 (ADT) Received: (qmail 14347 invoked from network); 16 Jul 2007 16:01:56 -0400 Received: from unknown (HELO D1RPQZB1) (msteben@192.168.1.181) by mail.autorevenue.com with SMTP; 16 Jul 2007 16:01:56 -0400 From: "Mark Steben" To: Subject: Index on a COALESCE function Date: Mon, 16 Jul 2007 15:57:30 -0400 Message-ID: <004f01c7c7e3$8b38fd60$b501a8c0@D1RPQZB1> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0050_01C7C7C2.04275D60" X-Mailer: Microsoft Office Outlook 11 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.2929 Thread-index: AcfH44sXxtna0mnbTe6hKUHM5/yeyw== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL=0.068, BAYES_50=0.001, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200707/160 X-Sequence-Number: 26141 This is a multi-part message in MIME format. ------=_NextPart_000_0050_01C7C7C2.04275D60 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit , Hi, I'm trying to index on a coalesce function: The index definition is CREATE INDEX emailrcpts_cid_coalesce_dtofpurch" btree (cid, (COALESCE(date_of_purchase, '1900-01-01'::date))) A portion of the query I am trying to optimize follows: select 45198705,false,id,next_avail_senddate(id,date(send_date)) from (select id,timeclause_combine(date(estmileage_timeclause(service_date,mileage,last_s ervice_date,last_mileage, date_of_purchase,year_purchased,10750,cid,serindex_date,id)), date(date_larger(date(coalesce(date_of_purchase, '1900-01-01')+timespan('45 days')), date(service_date+timespan('44 days')))), date(null),date(create_date),9,false) as send_date,last_send I can't seem to get this index to work on the function, just on the cid column. Any ideas would be appreciated Thank you, Mark Steben Senior Database Administrator @utoRevenueT A Dominion Enterprises Company 480 Pleasant Street Suite B200 Lee, MA 01238 413-243-4800 Home Office 413-243-4809 Corporate Fax msteben @autorevenue.com Visit our new website at www.autorevenue.com IMPORTANT: The information contained in this e-mail message is confidential and is intended only for the named addressee(s). If the reader of this e-mail message is not the intended recipient (or the individual responsible for the delivery of this e-mail message to the intended recipient), please be advised that any re-use, dissemination, distribution or copying of this e-mail message is prohibited. If you have received this e-mail message in error, please reply to the sender that you have received this e-mail message in error and then delete it. Thank you. ------=_NextPart_000_0050_01C7C7C2.04275D60 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

, Hi, I'm trying to index on a = coalesce function:

  The index definition is CREATE INDEX  emailrcpts_cid_coalesce_dtofpurch" btree = (cid, (COALESCE(date_of_purchase, = '1900-01-01'::date)))

 

A portion of the query I am = trying to optimize follows:

 

 select 45198705,false,id,next_avail_senddate(id,date(send_date)) from =

 (select id,timeclause_combine(date(estmileage_timeclause(service_date,mileage,las= t_service_date,last_mileage,

   = date_of_purchase,year_purchased,10750,cid,serindex_date,id)),<= /span>

   date(date_larger(date(coalesce(date_of_purchase, = '1900-01-01')+timespan('45 days')),

   = date(service_date+timespan('44 days')))),

   date(null),date(create_date),9,false) as = send_date,last_send


I can't seem to get this index to work on the function, = just on the cid column. Any ideas would be appreciated

 

Thank you,

 

Mark Steben

Senior Database Administrator
@utoRevenue™
A Dominion = Enterprises Company
480 = Pleasant Street
Suite = B200
Lee, MA 01238
413-243-4800 Home Office 
413-243-4809 Corporate Fax

msteben@autorevenue.com

Visit our = new website at
www.autorevenue.com

 

IMPORTANT: The information = contained in this e-mail message is confidential and is intended only for the named addressee(s). If the reader of this e-mail message is not the intended recipient (or the individual responsible for the delivery of this e-mail message to the intended recipient), please be advised that any re-use, dissemination, distribution or copying of this e-mail message is = prohibited.  If you have received this e-mail message in error, please reply to = the sender that you have received this e-mail message in error and then = delete it.  Thank you.

 

------=_NextPart_000_0050_01C7C7C2.04275D60--