pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedIndex on a COALESCE function
2+ messages / 2 participants
[nested] [flat]
* Index on a COALESCE function
@ 2007-07-16 19:57 Mark Steben <msteben@autorevenue.com>
2007-07-16 20:12 ` Re: Index on a COALESCE function Richard Broersma Jr <rabroersma@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: Mark Steben @ 2007-07-16 19:57 UTC (permalink / raw)
To: pgsql-admin
, 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 <blocked::mailto:name@autorevenue.com> @autorevenue.com
Visit our new website at
<blocked::http://www.autorevenue.com/; 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Index on a COALESCE function
2007-07-16 19:57 Index on a COALESCE function Mark Steben <msteben@autorevenue.com>
@ 2007-07-16 20:12 ` Richard Broersma Jr <rabroersma@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Richard Broersma Jr @ 2007-07-16 20:12 UTC (permalink / raw)
To: Mark Steben <msteben@autorevenue.com>; pgsql-admin
--- Mark Steben <msteben@autorevenue.com> wrote:
> 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
IIUC, indexs are only used in JOINS and WHERE conditions. I don't see either of those in your
query.
Regards,
Richard Broersma Jr.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-07-16 20:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 19:57 Index on a COALESCE function Mark Steben <msteben@autorevenue.com>
2007-07-16 20:12 ` Richard Broersma Jr <rabroersma@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox