Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJQ34-0000RM-66 for pgsql-sql@arkaria.postgresql.org; Fri, 28 Feb 2014 16:12:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WJQ33-0005QC-Lc for pgsql-sql@arkaria.postgresql.org; Fri, 28 Feb 2014 16:12:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJQ32-0005Q5-KC for pgsql-sql@postgresql.org; Fri, 28 Feb 2014 16:12:28 +0000 Received: from zimbra.isdd.sk ([91.233.248.204]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJQ2v-0000gb-PC for pgsql-sql@postgresql.org; Fri, 28 Feb 2014 16:12:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.isdd.sk (Postfix) with ESMTP id 5D80FAC86A7; Fri, 28 Feb 2014 17:12:21 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.isdd.sk Received: from zimbra.isdd.sk ([127.0.0.1]) by localhost (zimbra.isdd.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zFezchMGIVeF; Fri, 28 Feb 2014 17:12:20 +0100 (CET) Received: from zimbra.isdd.sk (zimbra.isdd.sk [91.233.248.204]) by zimbra.isdd.sk (Postfix) with ESMTP id 35E77AC860F; Fri, 28 Feb 2014 17:12:20 +0100 (CET) Date: Fri, 28 Feb 2014 17:12:20 +0100 (CET) From: Jan Ostrochovsky To: David Johnston Cc: pgsql-sql@postgresql.org Message-ID: <1083597622.602688.1393603940121.JavaMail.root@mobiletech.sk> In-Reply-To: <1393601978985-5794056.post@n5.nabble.com> Subject: Re: how to effectively SELECT new "customers" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_602687_1418346646.1393603940120" X-Originating-IP: [10.8.253.141] X-Mailer: Zimbra 7.2.6_GA_2926 (ZimbraWebClient - GC33 (Win)/7.2.6_GA_2926) X-Pg-Spam-Score: -0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org ------=_Part_602687_1418346646.1393603940120 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "David Johnston" > 9.3 adds materialized views syntax and functionality directly into > PostgreSQL but you can "roll your own" in any version and that is > what I > would suggest. > I would probably focus on getting a single reporting period to > execute > performantly and just use a loop to build up the materialized view > period-by-period. > I don't know how you want to go about dealing with your payment > channel > since it depends on whether a customer can make use of more than one > and > whether their "new-ness" is impacted by such. > Incorporating other data is as simple as building the different > pieces and > joining them together into a final output; usually through a series > of > CTEs/WITH sub-queries. > David J. > -- > View this message in context: > http://postgresql.1045698.n5.nabble.com/how-to-effectively-SELECT-new-customers-tp5793867p5794056.html > Sent from the PostgreSQL - sql mailing list archive at Nabble.com. > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql customer may have various payment channels during the time... new-ness is not impacted by the channel, it does not matter from which channel, all customer_id occurences count (in determined filtration criteria, e.g. town, service, subservice) and there are also other filtration and grouping criteria (town, service, subservice) and user of reporting tool should have possibility to select from those... there are dozens of services and subservices, cca 4 payment channels, dozens of towns... therefore preprocessing through materialized view (if I understand your suggestion correctly), would contain a lot of combinations, it seems quite complex for me in these circumstances I also considered WITH (CTEs) previously, I will rethink it yet, after these your recommendations thanks ------=_Part_602687_1418346646.1393603940120 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: times new roman,new york,times,serif; font-size: = 12pt; color: #000000'>
From: "David Johnston" <polo= bo@yahoo.com>

9.3 adds materialized views syntax and functionalit= y directly into
PostgreSQL but you can "roll your own" in any version an= d that is what I
would suggest.

I would probably focus on getting= a single reporting period to execute
performantly and just use a loop t= o build up the materialized view
period-by-period.

I don't know h= ow you want to go about dealing with your payment channel
since it depen= ds on whether a customer can make use of more than one and
whether their= "new-ness" is impacted by such.

Incorporating other data is as simp= le as building the different pieces and
joining them together into a fin= al output; usually through a series of
CTEs/WITH sub-queries.

Dav= id J.





--
View this message in context: http://pos= tgresql.1045698.n5.nabble.com/how-to-effectively-SELECT-new-customers-tp579= 3867p5794056.html
Sent from the PostgreSQL - sql mailing list archive at= Nabble.com.


--
Sent via pgsql-sql mailing list (pgsql-sql@p= ostgresql.org)
To make changes to your subscription:
http://www.postg= resql.org/mailpref/pgsql-sql
customer may have various paym= ent channels during the time... new-ness is not impacted by the channel, it= does not matter from which channel, all customer_id occurences count (in d= etermined filtration criteria, e.g. town, service, subservice)

and there are also other filtration and grouping criteria (town, ser= vice, subservice) and user of reporting tool should have possibility to sel= ect from those... there are dozens of services and subservices, cca 4 payme= nt channels, dozens of towns... therefore preprocessing through materialize= d view (if I understand your suggestion correctly), would contain a lot of = combinations, it seems quite complex for me in these circumstances

I also considered WITH (CTEs) previously, I will rethink i= t yet, after these your recommendations

thanks
------=_Part_602687_1418346646.1393603940120--