X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 36130D1B502 for ; Mon, 29 Sep 2003 21:18:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 71629-10 for ; Mon, 29 Sep 2003 18:18:12 -0300 (ADT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id 3FF2FD1B50A for ; Mon, 29 Sep 2003 18:18:10 -0300 (ADT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 841D23F52; Mon, 29 Sep 2003 17:17:49 -0400 (EDT) From: "Dan Langille" To: Jean-Luc Lachance Date: Mon, 29 Sep 2003 17:19:04 -0400 MIME-Version: 1.0 Subject: Re: Cc: Dan Langille , pgsql-sql@postgresql.org Message-ID: <3F786988.30024.356FBB90@localhost> In-reply-to: <3F783BD8.48101D85@nsd.ca> X-mailer: Pegasus Mail for Windows (v4.02a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/415 X-Sequence-Number: 15393 On 29 Sep 2003 at 10:04, Jean-Luc Lachance wrote: > Wouldn't: > > insert into r > select count(*) > from users > where date( lastlogin) > current_date - MaxDays * interval '' 1 day'' > group by date( lastlogin); > > be more efficient? Yes it would, by a factor of 5. P.S. but it would not show dates for which there are no logins. The above can return zero rows. The previous example always returns MaxDays rows. -- Dan Langille : http://www.langille.org/