Re: proposal: searching in array function - array_position

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Petr Jelinek <petr(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: proposal: searching in array function - array_position
Date: 2015-03-11 21:37:30
Message-ID: CAFj8pRAyDyPQSb5ZdH0KzLB_e1xV6aQw3xXN1NCAdhN=J9gxxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-03-11 22:14 GMT+01:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:

> On 3/11/15 1:29 AM, Pavel Stehule wrote:
>
>>
>> What is this comment supposed to mean? There is no 'width_array'...
>>
>>
>> It is typo (I am sorry) - should be width_bucket(, array)
>>
>> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=
>> e80252d424278abf65b624669c8e6b3fe8587cac
>>
>> The code is similar, but it expect large **sorted** input. array_offset
>> works on unsorted (alphabetical unsorted) data sets - like days of week ..
>>
>
> The functions are serving rather different purposes, so I'm not sure it's
> worth mentioning. If we do want to mention it, then something like the
> following should be added to *both* functions:
>

ok, I removed this note.

I added comment about wrapping and I simplified a code there - this method
is used more time in pg for same purposes.

Merged Jim's changes in doc

Pavel

>
> * This code is similar to width_bucket()
>
> and
>
> * This code is similar to array_offset()
>
> Incidentally, isn't it bad that we're doing all these static assignments
> inside the loop in width_bucket? Or can we count on the compiler to
> recognize this?
>
> http://lnk.nu/github.com/1dvrr.c
>
> --
> Jim Nasby, Data Architect, Blue Treble Consulting
> Data in Trouble? Get it in Treble! http://BlueTreble.com
>

Attachment Content-Type Size
array_offset-05.patch text/x-patch 19.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-03-11 21:50:09 Re: proposal: searching in array function - array_position
Previous Message Jim Nasby 2015-03-11 21:36:55 Re: Proposal : REINDEX xxx VERBOSE