Re: pgsql-function - Mailing list pgsql-sql

From Rishi Ranjan
Subject Re: pgsql-function
Date
Msg-id CALiz8WSSMtG8Gp5EE11i6PpFLLMzTqhEL_XnDuDQatKkdv4Qgg@mail.gmail.com
Whole thread Raw
In response to Re: pgsql-function  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: pgsql-function
List pgsql-sql


we are using version 9.4.
2) The result of above calculation i need to use in different calculation . means output of this calculation will let us to determine the value of  some parameters of other equation like below

y= ((y2-y1)/(x2-x1 ))x+ (y1- (y2-y1)/(x2-x1 ) x1 )

where x1,y1,x2,y2 parameters are defined and whose value need to be picked based on value of x (being calculated from above scenario provided with sample data)

so help me to decide in what way we can proceed


3) from above data in firstoccurence column there is up time and down time of some device and  we need to choose higher severity value .



On 14 April 2015 at 04:27, hubert depesz lubaczewski <depesz@depesz.com> wrote:
On Tue, Apr 14, 2015 at 03:39:38AM -0700, Rishi Ranjan wrote:
> i have data like below and where ap_key is same for two different
> first_occurence column . here i need to write a function which can
> calculate the difference of two timestamp values for a Ap_Key and then with
> difference it should multiply the severity

1. Why does it have to be a function? Can't it simply be a query?
2. Which pg version do you use?
3. Which severity to use? from the earlier FIRSTOCCURRENCE, or later, or
   simply higher/lower SEVERITY?

Basically what you're looking for is most likely some group by with
min/max.

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

pgsql-sql by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: pgsql-function
Next
From: "David G. Johnston"
Date:
Subject: Re: pgsql-function