Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8181D632697 for ; Wed, 14 Apr 2010 13:14:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 20847-06 for ; Wed, 14 Apr 2010 16:14:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f46.google.com (mail-ww0-f46.google.com [74.125.82.46]) by mail.postgresql.org (Postfix) with ESMTP id 96BF5632538 for ; Wed, 14 Apr 2010 13:14:31 -0300 (ADT) Received: by wwb22 with SMTP id 22so16317wwb.19 for ; Wed, 14 Apr 2010 09:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=JrJG+oyoAPkmwH3pFtKJZv7f1zRc4yotcaUzplkuVyk=; b=YX6MdY28Wm/HfwgL8gZE0Lxok+Ac1KJHjlNnQlqGFnjcv8frKzlDEoHBBS2wGozKV0 VgqR2/6kgXY3wIbq8UIFPsG85kFZEzKjlSQwwUChIb8tgYUDjMIaIARVoa3YcBlwcyBT 5srAXgmgP3Eoou/4KpMlptLpkfWn7lDodJhg8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=pWvll7KMzqN8RuJLpU4BA5chD5vzy7yWUe3ORXzw44gid4kTGTFy6rsHr1nvgrTycs TEO4ig7JAWkNJwEXYa/4XxaKI6VN50IbrDf3YUswF5JK6EOdlJ+oHrM09nnqsgk160wj 1dWYm28rW5+KDusw3Jms7nkI0fdQBhIIiXDoY= MIME-Version: 1.0 Received: by 10.216.233.151 with HTTP; Wed, 14 Apr 2010 09:14:30 -0700 (PDT) In-Reply-To: <20100414161152.GA17805@apartia.fr> References: <20100414145434.GA13682@apartia.fr> <20100414154958.GA16847@apartia.fr> <20100414161152.GA17805@apartia.fr> Date: Wed, 14 Apr 2010 18:14:30 +0200 Received: by 10.216.86.82 with SMTP id v60mr5003188wee.180.1271261670442; Wed, 14 Apr 2010 09:14:30 -0700 (PDT) Message-ID: Subject: Re: graphing time series data From: Pavel Stehule To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.108 tagged_above=-10 required=5 tests=AWL=-0.208, BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/56 X-Sequence-Number: 33983 2010/4/14 Louis-David Mitterrand : > On Wed, Apr 14, 2010 at 06:06:59PM +0200, Pavel Stehule wrote: >> I don't understand well. Why you don't use a function date_trunc(), >> >> select date_trunc('week', created), count(*) >> from price >> group by date_trunc('week', created) > > Because if a price doesn't change for more than a week, then some weeks > will have bad statistical distribution (i.e not including prices which > only have their 'modified' updated). So I (think I) need to (1) generate > the weeks separately and (2) average prices that are current for each > week. > > But I could be missing something obvious. ok Pavel > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql >