Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXn1c-0004T5-B8 for pgsql-admin@arkaria.postgresql.org; Thu, 02 Mar 2023 17:47:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXn1a-0001xZ-H1 for pgsql-admin@arkaria.postgresql.org; Thu, 02 Mar 2023 17:47:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXn1a-0001xP-2S for pgsql-admin@lists.postgresql.org; Thu, 02 Mar 2023 17:47:26 +0000 Received: from nativespace-chaldene.ns-chaldene.com ([212.53.86.59]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXn1X-0000eJ-9f for pgsql-admin@lists.postgresql.org; Thu, 02 Mar 2023 17:47:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=davebolt.co.uk; s=default; h=Content-Type:MIME-Version:Message-ID:Date: Subject:In-Reply-To:References:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=G/c72X5LrBPXw5c2QbZu5t8ZTQrzuuXQupAFQjshjr8=; b=p2m3zmg7kVEM+iBfc7cdpOy18 xcijtSMyaXYJGLHkVapmT9H/e70xbfHFI4fS8AJEcn6xKEIn2KseHcmS2FUGUut+kbvcRx5efAlqN eP9i+czRIYr21dv1vb1c8+D7FE113610UnFS/DDlaCunIVAbx1fNBugvHBst5+W69VSbc=; Received: from davebolt.plus.com ([80.229.145.181]:49185 helo=BelongadaveX) by nativespace-chaldene.ns-chaldene.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1pXn1S-0004Wr-Or; Thu, 02 Mar 2023 17:47:18 +0000 From: To: "'Govardhan .G'" , References: In-Reply-To: Subject: RE: Forcasting in Postgresql Date: Thu, 2 Mar 2023 17:47:19 -0000 Message-ID: <020b01d94d2f$0933ed60$1b9bc820$@co.uk> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_020C_01D94D2F.09341470" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdlMElX+jefjC9XPRzyH9Hz9tkkAhgBFgE5w Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - nativespace-chaldene.ns-chaldene.com X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - davebolt.co.uk X-Get-Message-Sender-Via: nativespace-chaldene.ns-chaldene.com: authenticated_id: dave@davebolt.co.uk X-Authenticated-Sender: nativespace-chaldene.ns-chaldene.com: dave@davebolt.co.uk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_020C_01D94D2F.09341470 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The short, unhelpful, answer is Yes. =20 Time to take a step back from the SQL and ask yourself: Can I write an algorithm to forecast some value dependant on values I = already have. =20 Very simple, somewhat vague, example. I have been selling Snow Tyres for some time so I have values for sales = along with dates. What are the average sales for each month? If I have more than one year=E2=80=99s data, what are the averages per = month over the last X years? Is a running average over the last few weeks/months/year any use? Some made up figures. Given that my average sales (in the Northern Hemisphere), were 20 in = November, 18 in December, 2 in January, 3 in February, I might expect = significant sales in November and December, but a drop in sales in = January and February. If last year the actual figures for November to February were 2,30,0,3, = and the previous year were 38,6,4,3 then there is still a drop in sales = in January and February, and still high sales in November and December, = it=E2=80=99s just a little more complicated. (If I were selling Snow Tyres, I would possibly look at these figures = and get some stock in for November so that I would have stock on hand = for the rest of the year, but now we are getting on to questions = relating to order lead times). =20 I noticed that what I had intended to be a simple example quickly = started to become more complicated. I needed a clear definition of what I had, and what I wanted, so I tried = to draw on my experience using a Stock Control System in the = =E2=80=9880s and make up some easy data. I know that real systems that = attempt to predict ordering quantities can soon get deep into = Statistics, which is not one of my strengths. For this particular = example I would be looking at search results for =E2=80=98stock = management algorithm=E2=80=99 as a starting point. =20 Hope this helps a little. Regards Dave Bolt =20 From: Govardhan .G [mailto:govardhansrr@gmail.com]=20 Sent: 01 March 2023 07:48 To: pgsql-admin@lists.postgresql.org Subject: Forcasting in Postgresql =20 Hi Folks, Is it possible to write a query for forecasting in postgresql. I have = been trying to search but have no clue. please advise Thanks=20 ------=_NextPart_000_020C_01D94D2F.09341470 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

The short, unhelpful, answer is Yes.

 

Time to take a step back from the SQL and ask = yourself:

Can I write an algorithm to forecast some value dependant on values I = already have.

 

Very simple, somewhat vague, example.

I have been selling Snow Tyres for some time so I have values for = sales along with dates.

What are the average sales for each month?

If I have more than one year=E2=80=99s data, what are the averages = per month over the last X years?

Is a running average over the last few weeks/months/year any = use?

Some made up figures.

Given that my average sales (in the Northern Hemisphere), were 20 in = November, 18 in December, 2 in January, 3 in February, I might expect = significant sales in November and December, but a drop in sales in = January and February.

If last year the actual figures for November to February were = 2,30,0,3, and the previous year were 38,6,4,3 then there is still a drop = in sales in January and February, and still high sales in November and = December, it=E2=80=99s just a little more = complicated.

(If I were selling Snow Tyres, I would possibly look at these figures = and get some stock in for November so that I would have stock on hand = for the rest of the year, but now we are getting on to questions = relating to order lead times).

 

I noticed that what I had intended to be a simple example quickly = started to become more complicated.

I needed a clear definition of what I had, and what I wanted, so I = tried to draw on my experience using a Stock Control System in the = =E2=80=9880s and make up some easy data. I know that real systems that = attempt to predict ordering quantities can soon get deep into = Statistics, which is not one of my strengths. For this particular = example I would be looking at search results for =E2=80=98stock = management algorithm=E2=80=99 as a starting = point.

 

Hope this helps a little.

Regards

Dave Bolt

 

From:= Govardhan = .G [mailto:govardhansrr@gmail.com]
Sent: 01 March 2023 = 07:48
To: pgsql-admin@lists.postgresql.org
Subject: = Forcasting in Postgresql

 

Hi = Folks,

Is it possible to write a query for forecasting in = postgresql. I have been trying to search but have no clue. please = advise

Thanks 

------=_NextPart_000_020C_01D94D2F.09341470--