pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Langille <dan@langille.org>
To: Jean-Luc Lachance <jllachan@nsd.ca>
Cc: Dan Langille <dan@langille.org>
Cc: pgsql-sql@postgresql.org
Subject: Re:
Date: Mon, 29 Sep 2003 17:19:04 -0400
Message-ID: <3F786988.30024.356FBB90@localhost> (raw)
In-Reply-To: <3F783BD8.48101D85@nsd.ca>

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/




view thread (6+ messages)

Message-ID: <3F786988.30024.356FBB90@localhost>
Permalink:  ../3F786988.30024.356FBB90@localhost/
Also on:    postgresql.org/message-id/3F786988.30024.356FBB90@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dan@langille.org, jllachan@nsd.ca
  Subject: Re:
  In-Reply-To: <3F786988.30024.356FBB90@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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