Re: Subtract one array from another, both with non-unique elements - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Subtract one array from another, both with non-unique elements
Date
Msg-id CAFj8pRAT3ZRrKoLtoL23OdEObAKAYxcArYm83+e5oAsWNN2Eig@mail.gmail.com
Whole thread Raw
In response to Re: Subtract one array from another, both with non-unique elements  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: Subtract one array from another, both with non-unique elements  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
Hi

2016-03-06 18:41 GMT+01:00 Alexander Farber <alexander.farber@gmail.com>:
Thank you, but shouldn't I better use FOREACH for my task?


SQL based solution (functional based) solution can be faster and shorter. PLpgSQL is nice language, but what you can do about arrays functionally, you should to do :). Usually it is significantly faster.

But, you can try - it is good example for learning, try to implement it different ways and compare speed.

Pavel
 

On Sun, Mar 6, 2016 at 6:34 PM, bricklen <bricklen@gmail.com> wrote:
On Sun, Mar 6, 2016 at 9:22 AM, Alexander Farber <alexander.farber@gmail.com> wrote:
could someone please recommend the most efficient way subtracting elements of one array from the other in PostgreSQL 9.5?

There are quite a few examples of array functions at http://postgres.cz/wiki/Array_based_functions, probably worth having a look.


pgsql-general by date:

Previous
From: Alexander Farber
Date:
Subject: Re: Subtract one array from another, both with non-unique elements
Next
From:
Date:
Subject: Does a call to a language handler provide a context/session, and somewhere to keep session data?