Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id ED7D62E003C for ; Sun, 4 May 2008 09:59:21 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55667-02 for ; Sun, 4 May 2008 09:59:14 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by developer.postgresql.org (Postfix) with ESMTP id 61E102E0038 for ; Sun, 4 May 2008 09:59:19 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.1/8.14.1) with ESMTP id m44CxEou056007 for ; Sun, 4 May 2008 09:59:14 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.1/8.14.1/Submit) id m44CTtRr044076 for pgsql-performance@postgresql.org; Sun, 4 May 2008 09:29:55 -0300 (ADT) (envelope-from news) From: Hannes Dorbath X-Newsgroups: pgsql.performance Subject: Fastest way / best practice to calculate "next birthdays" Date: Sun, 04 May 2008 14:29:58 +0200 Organization: Hub.Org Networking Services Lines: 13 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/45 X-Sequence-Number: 30013 The subject basically says it all, I'm looking for the fastest (indexable) way to calculate the next birthdays relative to NOW() from a dataset of about 1 million users. I'm currently using a function based index, but leap year handling / mapping February 29 to February 28 gives me some headaches. Is there any best practice to do that in PostgreSQL? -- Best regards, Hannes Dorbath