Re: ASOF join

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ASOF join
Date: 2017-06-15 23:51:34
Message-ID: CAEepm=2fec+U4chPt0U+Dkb-B=-grZq1JT-DmL-20P9ZFwi6vQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 16, 2017 at 4:20 AM, Konstantin Knizhnik
<k(dot)knizhnik(at)postgrespro(dot)ru> wrote:
> I wonder if there were some discussion/attempts to add ASOF join to Postgres
> (sorry, may be there is better term for it, I am refereeing KDB definition:
> http://code.kx.com/wiki/Reference/aj ).

Interesting idea. Also in Pandas:

http://pandas.pydata.org/pandas-docs/version/0.19.0/generated/pandas.merge_asof.html#pandas.merge_asof

I suppose you could write a function that pulls tuples out of a bunch
of cursors and zips them together like this, as a kind of hand-coded
special merge join "except that we match on nearest key rather than
equal keys" (as they put it).

I've written code like this before in a trading context, where we
called that 'previous tick interpolation', and in a scientific context
where other kinds of interpolation were called for (so not really
matching a tuple but synthesising one if no exact match). If you view
the former case as a kind of degenerate case of interpolation then it
doesn't feel like a "join" as we know it, but clearly it is. I had
never considered before that such things might belong inside the
database as a kind of join operator.

--
Thomas Munro
http://www.enterprisedb.com

In response to

  • ASOF join at 2017-06-15 16:20:56 from Konstantin Knizhnik

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-06-15 23:51:36 Re: WIP: Data at rest encryption
Previous Message Stephen Frost 2017-06-15 23:51:10 Re: WIP: Data at rest encryption