Re: Mechanics of Select

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Willem Buitendyk <willem(at)pcfish(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Mechanics of Select
Date: 2008-02-10 23:30:13
Message-ID: Pine.GSO.4.64.0802101823430.29879@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 10 Feb 2008, Willem Buitendyk wrote:

> I have the following function that returns the first day of the next month
> from whatever date is inserted.

See if you can do this with date_trunc instead to avoid calling a
function, which avoids the whole thing. The first day of next month is:

select date_trunc('month',now())+interval '1 month';

I'd be curious how the runtime using that compares with the plpgsql
version you've done.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2008-02-10 23:37:19 Re: Mechanics of Select
Previous Message Tom Lane 2008-02-10 23:26:58 Re: Alter Temporary table in Stored Procedure