Re: Interpolation problem - pg 12.4 - full correct version! - Mailing list pgsql-general

From Pól Ua Laoínecháin
Subject Re: Interpolation problem - pg 12.4 - full correct version!
Date
Msg-id CAF4RT5RuDTqpgHyjkzUiju08KibCiO+LY+rqejrF8j+fS-59FA@mail.gmail.com
Whole thread Raw
In response to Re: Interpolation problem - pg 12.4 - full correct version!  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
Hi,

>> So, my question is: Is there a recognised technique (using SQL only,
>> not PL/pgSQL - soutions based on the latter are easy to find) whereby
>> I can do a basic Linear Interpolation?

> I don't have a recognized technique, nor care to ponder one right now, but what you've described would best be done
inpure SQL using WITH RECURSIVE, which provides an iterative approach to SQL result building.  Which is more commonly
donein a procedural language.  The algorithm you describe is an iterative algorithm and so I'm wondering why place the
arbitraryrestriction on using pure SQL when it likely wouldn't provide a very readable nor performant solution relative
toa procedural (pl/pgsql or otherwise) one? 

Well, it would be trivial to do something with PL/pgSQL (just Google
and download the code - there are a few examples around).

I''m a big fan of this site https://explainextended.com/ - this guy
can do anything with SQL - I'd like to try and learn how to do the
same.

You're idea of RECURSIVE is exactly along the lines I was thinking of
- I'll persevere and see what I can come up with using WITH RECURSIVE
- I've use it before.

Thanks for your input and rgs,


Pól...


> David J.



pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: Window functions speed
Next
From: Pól Ua Laoínecháin
Date:
Subject: Re: Interpolation problem - pg 12.4 - full correct version!