Re: [HACKERS] Review: GiST support for UUIDs

2016-02-05 Thread Paul Jungwirth
On 12/25/2015 03:23 AM, Ildus Kurbangaliev wrote: On Fri, 25 Dec 2015 13:34:25 +0300 Teodor Sigaev wrote: First, variables (high and low) should not be declared in the middle of code. Second, assert will fail if ua.v64[0] == ub.v64[0] and ua.v64[1] > ub.v64[1] although it's a

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-25 Thread Teodor Sigaev
Thank you, but I have some notices about static float uuid_parts_distance(pg_uuid_t *a, pg_uuid_t *b) { pg_uuid_t ua, ub; const double mp = pow(2, -64); uuid_cnv(a, ); uuid_cnv(b, ); Assert(ua.v64[0] > ub.v64[0]); uint64 high = ua.v64[0] - ub.v64[0]; uint64 low =

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-25 Thread Ildus Kurbangaliev
On Fri, 25 Dec 2015 13:34:25 +0300 Teodor Sigaev wrote: > Thank you, but I have some notices about > static float > uuid_parts_distance(pg_uuid_t *a, pg_uuid_t *b) > { > pg_uuid_t ua, ub; > const double mp = pow(2, -64); > > uuid_cnv(a, ); > uuid_cnv(b, );

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-24 Thread Ildus Kurbangaliev
On Wed, 23 Dec 2015 16:36:23 -0800 Paul Jungwirth wrote: > On 12/23/2015 08:10 AM, Ildus Kurbangaliev wrote: > > There is a more improved version of the patch. Main idea is to > > present uuid as two uint64 values, and make comparisons and penalty > > calculation

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-23 Thread Ildus Kurbangaliev
On Tue, 15 Sep 2015 09:03:00 +0300 Teodor Sigaev wrote: > Paul Jungwirth wrote: > >> Or something like this in pseudocode: > >> > >> numeric = int8_numeric(*(uint64 *)(>data[0])) * > >> int8_numeric(MAX_INT64) + int8_numeric(*(uint64 *)(>data[8])) > > > > This is more like

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-23 Thread Paul Jungwirth
On 12/23/2015 08:10 AM, Ildus Kurbangaliev wrote: There is a more improved version of the patch. Main idea is to present uuid as two uint64 values, and make comparisons and penalty calculation based on these values. This approach is much faster than using memcmp for uuid comparisons. Thank you

Re: [HACKERS] Review: GiST support for UUIDs

2015-12-22 Thread Michael Paquier
On Tue, Sep 15, 2015 at 3:03 PM, Teodor Sigaev wrote: > > > Paul Jungwirth wrote: >>> >>> Or something like this in pseudocode: >>> >>> numeric = int8_numeric(*(uint64 *)(>data[0])) * >>> int8_numeric(MAX_INT64) + int8_numeric(*(uint64 *)(>data[8])) >> >> >> This is more like

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-15 Thread Teodor Sigaev
Paul Jungwirth wrote: Or something like this in pseudocode: numeric = int8_numeric(*(uint64 *)(>data[0])) * int8_numeric(MAX_INT64) + int8_numeric(*(uint64 *)(>data[8])) This is more like what I was hoping for, rather than converting to a string and back. Would you mind confirming for me:

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Andres Freund
Please post reviews to the original thread unless that's already humongously large. Otherwise somebody needs to manually link up the threads in the CF application. It also makes it much harder to follow the development because there'll likely be a new version of the patch after a review. Which

[HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Teodor Sigaev
http://www.postgresql.org/message-id/flat/ca+renyvephxto1c7dfbvjp1gymuc0-3qdnwpn30-noo5mpy...@mail.gmail.com#ca+renyvephxto1c7dfbvjp1gymuc0-3qdnwpn30-noo5mpy...@mail.gmail.com Patch looks perfect but it's still needed some work. 0) rebase to current HEAD (done, in attach) 1) UUIDSIZE ->

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Teodor Sigaev
Andres Freund wrote: Please post reviews to the original thread unless that's already humongously large. I've lost original mail. Sorry. Otherwise somebody needs to manually link up the threads in the CF application. Of course, I did it It also makes it much harder to follow the

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Teodor Sigaev
Paul Jungwirth wrote: 2) static double uuid2num(const pg_uuid_t *i) { return *((uint64 *)i); } It isn't looked as correct transformation for me. May be, it's better to transform to numeric type (UUID looks like a 16-digit hexademical number) and follow

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Paul Jungwirth
Or something like this in pseudocode: numeric = int8_numeric(*(uint64 *)(>data[0])) * int8_numeric(MAX_INT64) + int8_numeric(*(uint64 *)(>data[8])) This is more like what I was hoping for, rather than converting to a string and back. Would you mind confirming for me: int8_numeric turns an

Re: [HACKERS] Review: GiST support for UUIDs

2015-09-14 Thread Paul Jungwirth
2) static double uuid2num(const pg_uuid_t *i) { return *((uint64 *)i); } It isn't looked as correct transformation for me. May be, it's better to transform to numeric type (UUID looks like a 16-digit hexademical number) and follow gbt_numeric_penalty()