Re: Tricky math in PSQL

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Kip Warner <kip(at)thevertigo(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Tricky math in PSQL
Date: 2016-04-22 19:37:57
Message-ID: CACjxUsOnMp0qzB111EbVLKFTPCrwQo1FSxvEeSEWFsBQE38BFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Apr 22, 2016 at 1:44 PM, Kip Warner <kip(at)thevertigo(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John R Pierce 2016-04-22 22:21:17 Re: Fwd: Process scheduling in postgres
Previous Message Kip Warner 2016-04-22 18:44:55 Tricky math in PSQL