Re: Subtract one array from another, both with non-unique elements

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Subtract one array from another, both with non-unique elements
Date: 2016-03-06 17:49:38
Message-ID: CAFj8pRAT3ZRrKoLtoL23OdEObAKAYxcArYm83+e5oAsWNN2Eig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

2016-03-06 18:41 GMT+01:00 Alexander Farber <alexander(dot)farber(at)gmail(dot)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(at)gmail(dot)com> wrote:
>
>> On Sun, Mar 6, 2016 at 9:22 AM, Alexander Farber <
>> alexander(dot)farber(at)gmail(dot)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.
>>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message david 2016-03-07 05:21:42 Does a call to a language handler provide a context/session, and somewhere to keep session data?
Previous Message Alexander Farber 2016-03-06 17:41:31 Re: Subtract one array from another, both with non-unique elements