Re: Tricky math in PSQL - Mailing list pgsql-novice

From Kevin Grittner
Subject Re: Tricky math in PSQL
Date
Msg-id CACjxUsOnMp0qzB111EbVLKFTPCrwQo1FSxvEeSEWFsBQE38BFw@mail.gmail.com
Whole thread Raw
In response to Tricky math in PSQL  (Kip Warner <kip@thevertigo.com>)
Responses Re: Tricky math in PSQL
List pgsql-novice
On Fri, Apr 22, 2016 at 1:44 PM, Kip Warner <kip@thevertigo.com> wrote:

> I am having problems trying to figure out the best way to implement a
> complicated function in PostgreSQL. I have tried my best to articulate
> my problem here:
>
>     http://pastebin.com/zwWmYMd0

Please include such information in the post, either directly or as
an attachment.  Messages on these lists go back over 18 years at
this point, and while you did flag that paste as "never delete",
who's to say whether pastebin will be around to keep the promise
that the URL will be valid 18 years from now?

> To understand it mathematically is not so hard, but to express it in
> PSQL syntax is hard for me.
>
> I am aware that the views and functions I have may not be the most
> efficient. I am open to suggestions for those too.

People can best help you if you provide a self-contained test case
-- on that actually runs from an empty database.  You will get more
responses, and are more likely to get to a good solution, if you
simplify the example as far as possible while still showing the
basic problem -- without ellipses or other non-executable visual
cues.

You may want to review this page and post again:

https://wiki.postgresql.org/wiki/SlowQueryQuestions

Also, keep in mind that plpgsql is not the only language available
within PostgreSQL; for statistics you might, for example, consider
plr.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-novice by date:

Previous
From: Kip Warner
Date:
Subject: Tricky math in PSQL
Next
From: Kip Warner
Date:
Subject: Re: Tricky math in PSQL