Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread David Rowley
On 22 March 2015 at 22:22, Andres Freund and...@2ndquadrant.com wrote: On March 22, 2015 6:17:28 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andres Freund
On March 22, 2015 10:34:04 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 6:22 PM, Andres Freund and...@2ndquadrant.com wrote: On March 22, 2015 6:17:28 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Petr Jelinek
On 22/03/15 10:35, Andres Freund wrote: On March 22, 2015 10:34:04 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 6:22 PM, Andres Freund and...@2ndquadrant.com That's due to a different patch though, right? When I checked earlier only jacana had

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andreas Karlsson
On 03/22/2015 11:47 AM, Petr Jelinek wrote: On 22/03/15 10:35, Andres Freund wrote: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacanadt=2015-03-21%2003%3A01%3A21 That's the stuff looking like random memory that I talk about above... If you look at it closely, it's actually not

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andres Freund
On March 22, 2015 6:17:28 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with that additional change. Let's see if the buildfarm thinks. jacana, apparently

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Michael Paquier
On Sun, Mar 22, 2015 at 6:34 PM, David Rowley dgrowle...@gmail.com wrote: On 22 March 2015 at 22:22, Andres Freund and...@2ndquadrant.com wrote: On March 22, 2015 6:17:28 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Petr Jelinek
On 22/03/15 13:59, Andreas Karlsson wrote: On 03/22/2015 11:47 AM, Petr Jelinek wrote: On 22/03/15 10:35, Andres Freund wrote: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacanadt=2015-03-21%2003%3A01%3A21 That's the stuff looking like random memory that I talk about above...

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andreas Karlsson
On 03/22/2015 10:20 PM, Andres Freund wrote: Yes, or a compiler bug. I looked through the code again and found and fixed one minor bug, but that doesnt' explain the problem. Strangely enough the bug looks like it has been fixed at jacana after your fix of my copypasto. Maybe the bug is

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andres Freund
On 2015-03-22 22:28:01 +0100, Andreas Karlsson wrote: On 03/22/2015 10:20 PM, Andres Freund wrote: Yes, or a compiler bug. I looked through the code again and found and fixed one minor bug, but that doesnt' explain the problem. Strangely enough the bug looks like it has been fixed at jacana

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andres Freund
On 2015-03-22 22:20:49 +0100, Andres Freund wrote: A compiler bug looks like a not unreasonable bet at this point. I've asked Andrew to recompile without optimizations... We'll see whether that makes a difference. Jacana is the only compiler with gcc 4.8.1 (or is it 4.8.0? there's conflicting

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Andres Freund
On 2015-03-22 22:00:13 +0100, Petr Jelinek wrote: On 22/03/15 13:59, Andreas Karlsson wrote: Would this mean the bug is most likely somewhere in int128_to_numericvar()? Maybe that version of gcc has a bug in some __int128 operator or I messed up the code there somehow. Yes, or a compiler bug.

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-22 Thread Michael Paquier
On Sun, Mar 22, 2015 at 6:22 PM, Andres Freund and...@2ndquadrant.com wrote: On March 22, 2015 6:17:28 AM GMT+01:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-21 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: Pushed with that additional change. Let's see if the buildfarm thinks. jacana, apparently alone among buildfarm members, does not like it. regards, tom lane -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-21 Thread Michael Paquier
On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with that additional change. Let's see if the buildfarm thinks. jacana, apparently alone among buildfarm members, does not like it. All the windows nodes don't pass tests

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-21 Thread Michael Paquier
On Sun, Mar 22, 2015 at 2:17 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with that additional change. Let's see if the buildfarm thinks. jacana, apparently alone

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-21 Thread David Rowley
On 22 March 2015 at 18:17, Michael Paquier michael.paqu...@gmail.com wrote: On Sun, Mar 22, 2015 at 12:32 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com writes: Pushed with that additional change. Let's see if the buildfarm thinks. jacana, apparently alone

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-20 Thread Peter Geoghegan
On Fri, Mar 20, 2015 at 2:39 AM, Andreas Karlsson andr...@proxel.se wrote: On 03/20/2015 10:32 AM, Andres Freund wrote: Pushed with that additional change. Let's see if the buildfarm thinks. Thanks for the feature. Thanks to you and all the reviewers for helping me out with it. Indeed.

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-20 Thread Andres Freund
On 2015-03-20 00:49:07 +0100, Andreas Karlsson wrote: On 03/19/2015 07:08 PM, Andres Freund wrote: Working on committing this: Nice fixes. Sorry about forgetting numericvar_to_int*. As for the reviewers those lists look pretty much correct. David Rowley should probably be added to the

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-20 Thread Andreas Karlsson
On 03/20/2015 10:32 AM, Andres Freund wrote: Pushed with that additional change. Let's see if the buildfarm thinks. Thanks for the feature. Thanks to you and all the reviewers for helping me out with it. Andreas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-19 Thread Andreas Karlsson
On 03/19/2015 07:08 PM, Andres Freund wrote: Working on committing this: Nice fixes. Sorry about forgetting numericvar_to_int*. As for the reviewers those lists look pretty much correct. David Rowley should probably be added to the second patch for his early review and benchmarking. --

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-19 Thread Peter Geoghegan
On Thu, Mar 19, 2015 at 4:49 PM, Andreas Karlsson andr...@proxel.se wrote: Nice fixes. Sorry about forgetting numericvar_to_int*. As for the reviewers those lists look pretty much correct. David Rowley should probably be added to the second patch for his early review and benchmarking. This

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Andres Freund
On 2015-03-17 20:50:48 -0700, Peter Geoghegan wrote: On Mon, Mar 16, 2015 at 6:22 AM, Petr Jelinek p...@2ndquadrant.com wrote: Do you think it is ready for committer? In my opinion, yes. If it wasn't for the autoconf parts of this, I'd probably agree with you. I need to go over that

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Peter Geoghegan
On Wed, Mar 18, 2015 at 3:16 PM, Andres Freund and...@2ndquadrant.com wrote: For another, Andreas has chosen to lump together __int128 and unsigned __int128 into one test, where the latter really doesn't receive coverage. On my urging actually. It's pretty darn unlikely that only one variant

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Peter Geoghegan
On Wed, Mar 18, 2015 at 4:07 PM, Andres Freund and...@2ndquadrant.com wrote: Given that we don't rely on C99, I don't think that actually matters. Lots of our platforms build on pre C99 compilers... I think it makes sense to say that this currently only tests for a gcc extension and might be

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Andres Freund
On 2015-03-18 15:59:52 -0700, Peter Geoghegan wrote: Okay. Attached revision has a few tweaks that reflect the status of int128/uint128 as specialized types that are basically only useful for this optimization, or other similar optimizations on compilers that either are GCC, or aim to be

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Andreas Karlsson
On 03/18/2015 11:59 PM, Peter Geoghegan wrote: Okay. Attached revision has a few tweaks that reflect the status of int128/uint128 as specialized types that are basically only useful for this optimization, or other similar optimizations on compilers that either are GCC, or aim to be compatible

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Andres Freund
On 2015-03-18 14:00:51 -0700, Peter Geoghegan wrote: Anyway, I think that it's not quite the same. For one thing, we're talking about a GCC extension, not a type described by C99. We don't care about snprintf support, for example. I don't see that that has any consequence wrt Andreas' test.

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-18 Thread Peter Geoghegan
On Wed, Mar 18, 2015 at 1:05 AM, Andres Freund and...@2ndquadrant.com wrote: I think it's a pretty direct copy of the 64bit code. I'm not entirely sure why this needs a AC_TRY_RUN with a compile fallback (for cross) and why a AC_TRY_LINK isn't sufficient? But then, you just copied that

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-17 Thread Peter Geoghegan
On Mon, Mar 16, 2015 at 6:22 AM, Petr Jelinek p...@2ndquadrant.com wrote: Do you think it is ready for committer? In my opinion, yes. If it wasn't for the autoconf parts of this, I'd probably agree with you. I need to go over that more carefully. -- Peter Geoghegan -- Sent via

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-16 Thread Petr Jelinek
On 16/03/15 00:37, Andreas Karlsson wrote: On 03/15/2015 09:47 PM, Petr Jelinek wrote: It's almost the same thing as you wrote but the 128 bit and 64 bit optimizations are put on the same level of optimized routines. But this is nitpicking at this point, I am happy with the patch as it stands

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-15 Thread Petr Jelinek
On 14/03/15 04:17, Andreas Karlsson wrote: On 03/13/2015 10:22 PM, Peter Geoghegan wrote: On Thu, Mar 12, 2015 at 6:23 PM, Andreas Karlsson andr...@proxel.se wrote: /* * Integer data types use Numeric accumulators to share code and avoid risk * of overflow. To speed up aggregation 128-bit

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-15 Thread Andreas Karlsson
On 03/15/2015 09:47 PM, Petr Jelinek wrote: It's almost the same thing as you wrote but the 128 bit and 64 bit optimizations are put on the same level of optimized routines. But this is nitpicking at this point, I am happy with the patch as it stands right now. Do you think it is ready for

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-13 Thread Peter Geoghegan
On Thu, Mar 12, 2015 at 6:23 PM, Andreas Karlsson andr...@proxel.se wrote: Fixed. Did you intend to attach a patch here? I think you should talk about the new thing first (just after the extant, first sentence Integer data types use Numeric...). Refer to where 128-bit integers are used and

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-13 Thread Andreas Karlsson
On 03/13/2015 10:22 PM, Peter Geoghegan wrote: On Thu, Mar 12, 2015 at 6:23 PM, Andreas Karlsson andr...@proxel.se wrote: /* * Integer data types use Numeric accumulators to share code and avoid risk * of overflow. To speed up aggregation 128-bit integer accumulators are * used instead

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread Andreas Karlsson
On 03/07/2015 07:18 PM, Petr Jelinek wrote: What I am wondering is if those numeric_int16_* functions that also deal with either the Int128AggState or NumericAggState should be renamed in similar fashion. You mean something like numeric_poly_sum instead of numeric_int16_sum? I personally am

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread Petr Jelinek
On 09/03/15 13:39, Andreas Karlsson wrote: On 03/07/2015 07:18 PM, Petr Jelinek wrote: What I am wondering is if those numeric_int16_* functions that also deal with either the Int128AggState or NumericAggState should be renamed in similar fashion. You mean something like numeric_poly_sum

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread David Fetter
On Mon, Mar 09, 2015 at 01:39:04PM +0100, Andreas Karlsson wrote: On 03/07/2015 07:18 PM, Petr Jelinek wrote: What I am wondering is if those numeric_int16_* functions that also deal with either the Int128AggState or NumericAggState should be renamed in similar fashion. You mean something

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread Petr Jelinek
On 09/03/15 18:39, David Fetter wrote: On Mon, Mar 09, 2015 at 01:39:04PM +0100, Andreas Karlsson wrote: On 03/07/2015 07:18 PM, Petr Jelinek wrote: What I am wondering is if those numeric_int16_* functions that also deal with either the Int128AggState or NumericAggState should be renamed in

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread Andreas Karlsson
On 03/07/2015 07:18 PM, Petr Jelinek wrote: What I am wondering is if those numeric_int16_* functions that also deal with either the Int128AggState or NumericAggState should be renamed in similar fashion. Here is a patch where I have renamed the functions. int128-agg-v7.patch - Rename

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-09 Thread Peter Geoghegan
On Mon, Mar 9, 2015 at 5:37 PM, Andreas Karlsson andr...@proxel.se wrote: int128-agg-v7.patch I see a spelling error: + * On platforms which support 128-bit integers some aggergates instead use a Other than that, the patch looks pretty good to me. You're generalizing from the example of

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-07 Thread Petr Jelinek
On 04/03/15 23:51, Andreas Karlsson wrote: On 01/29/2015 12:28 AM, Peter Geoghegan wrote: * I'm not sure about the idea of polymorphic catalog functions (that return the type internal, but the actual struct returned varying based on build settings). I tend to think that things would be better

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-03-04 Thread Andreas Karlsson
On 01/29/2015 12:28 AM, Peter Geoghegan wrote: On Mon, Jan 26, 2015 at 11:21 PM, Andreas Karlsson andr...@proxel.se wrote: Do you also think the SQL functions should be named numeric_int128_sum, numeric_int128_avg, etc? Some quick review comments. These apply to int128-agg-v5.patch. * Why is

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-02-16 Thread Andreas Karlsson
On 02/13/2015 02:07 PM, Michael Paquier wrote: Andreas, are you planning to continue working on this patch? Peter has provided some comments that are still unanswered. Yes, but I am quite busy right now. I will try to find time some time later this week. -- Andreas Karlsson -- Sent via

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-02-13 Thread Michael Paquier
On Thu, Jan 29, 2015 at 8:28 AM, Peter Geoghegan p...@heroku.com wrote: On Mon, Jan 26, 2015 at 11:21 PM, Andreas Karlsson andr...@proxel.se wrote: Do you also think the SQL functions should be named numeric_int128_sum, numeric_int128_avg, etc? Some quick review comments. These apply to

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-28 Thread Peter Geoghegan
On Mon, Jan 26, 2015 at 11:21 PM, Andreas Karlsson andr...@proxel.se wrote: Do you also think the SQL functions should be named numeric_int128_sum, numeric_int128_avg, etc? Some quick review comments. These apply to int128-agg-v5.patch. * Why is there no declaration of the function

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-27 Thread Andres Freund
On 2015-01-27 08:21:57 +0100, Andreas Karlsson wrote: On 01/23/2015 02:58 AM, Petr Jelinek wrote: On 23/01/15 00:40, Andreas Karlsson wrote: - Renamed some things from int12 to int128, there are still some places with int16 which I am not sure what to do with. I'd vote for renaming them to

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-27 Thread Andreas Karlsson
On 01/27/2015 09:05 AM, Andres Freund wrote: On 2015-01-27 08:21:57 +0100, Andreas Karlsson wrote: On 01/23/2015 02:58 AM, Petr Jelinek wrote: On 23/01/15 00:40, Andreas Karlsson wrote: - Renamed some things from int12 to int128, there are still some places with int16 which I am not sure what

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-26 Thread Andreas Karlsson
On 01/23/2015 02:58 AM, Petr Jelinek wrote: On 23/01/15 00:40, Andreas Karlsson wrote: - Renamed some things from int12 to int128, there are still some places with int16 which I am not sure what to do with. I'd vote for renaming them to int128 too, there is enough C functions that user int16

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-22 Thread Andreas Karlsson
A new version of the patch is attached, which changes the following: - Changed from using __int128_t to __int128. - Actually compiles and runs code in configure to see that int128 works. - No longer tests for __uint128_t. - Updated pg_config.h.win32 - Renamed some things from int12 to int128,

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-22 Thread Petr Jelinek
On 23/01/15 00:40, Andreas Karlsson wrote: - Renamed some things from int12 to int128, there are still some places with int16 which I am not sure what to do with. I'd vote for renaming them to int128 too, there is enough C functions that user int16 for 16bit integer that this is going to be

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-22 Thread Andreas Karlsson
On 01/11/2015 02:36 AM, Andres Freund wrote: a) Afaics only __int128/unsigned __int128 is defined. See https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html b) I'm doubtful that AC_CHECK_TYPES is a sufficiently good test on all platforms. IIRC gcc will generate calls to functions to

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-17 Thread Andreas Karlsson
On 12/31/2014 03:00 PM, David Rowley wrote: hmm, I think it should be changed to int128 then. Pitty int4 was selected as a name instead of int32 back in the day... I'm going to mark the patch as waiting on author, pending those two changes. My view with the size estimates change is that if a

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-11 Thread Tom Lane
Andreas Karlsson andr...@proxel.se writes: On 01/11/2015 02:36 AM, Andres Freund wrote: b) I'm doubtful that AC_CHECK_TYPES is a sufficiently good test on all platforms. Should I fix it to actually compile some code which uses the 128-bit types? We used to have code in configure to test that

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-11 Thread Petr Jelinek
On 11/01/15 05:07, Andreas Karlsson wrote: On 01/11/2015 02:36 AM, Andres Freund wrote: @@ -3030,6 +3139,18 @@ int8_avg_accum(PG_FUNCTION_ARGS) Datum int2_accum_inv(PG_FUNCTION_ARGS) { +#ifdef HAVE_INT128 +Int16AggState *state; + +state = PG_ARGISNULL(0) ? NULL : (Int16AggState *)

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-11 Thread Andres Freund
On 2015-01-11 05:07:13 +0100, Andreas Karlsson wrote: On 01/11/2015 02:36 AM, Andres Freund wrote: a) Afaics only __int128/unsigned __int128 is defined. See https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html Both GCC and Clang defines both of them. Which you use seems to just be a

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-10 Thread Andreas Karlsson
On 01/11/2015 02:36 AM, Andres Freund wrote: a) Afaics only __int128/unsigned __int128 is defined. See https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html Both GCC and Clang defines both of them. Which you use seems to just be a matter of preference. b) I'm doubtful that

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-10 Thread Andres Freund
Hi, +# Check if platform support gcc style 128-bit integers. +AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], []) Hm, I'm not sure that's sufficent. Three things: a) Afaics only __int128/unsigned __int128 is defined. See https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html b) I'm

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Tom Lane
Heikki Linnakangas hlinnakan...@vmware.com writes: On 01/02/2015 11:41 PM, Tom Lane wrote: What might be worth trying is establishing a hard-and-fast boundary between C land and SQL land, with bitwise names in C and bytewise names in SQL. This would mean, for example, that int4pl() would be

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Tom Lane
Jim Nasby jim.na...@bluetreble.com writes: On 12/31/14, 8:13 AM, Andres Freund wrote: Note that the C datatype has been int32/int64 for a while now, it's just the SQL datatype and the names of its support functions. Given that, afaiu, we're talking about the C datatype it seems pretty clear

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Jim Nasby
On 12/31/14, 8:13 AM, Andres Freund wrote: On 2015-01-01 03:00:50 +1300, David Rowley wrote: 2. References to int16 meaning 16 bytes. I'm really in two minds about this, it's quite nice to keep the natural flow, int4, int8, int16, but I can't help think that this will confuse someone one day.

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Heikki Linnakangas
On 01/02/2015 11:41 PM, Tom Lane wrote: What might be worth trying is establishing a hard-and-fast boundary between C land and SQL land, with bitwise names in C and bytewise names in SQL. This would mean, for example, that int4pl() would be renamed to int32pl() so far as the C function goes,

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Claudio Freire
On Fri, Jan 2, 2015 at 7:57 PM, Jim Nasby jim.na...@bluetreble.com wrote: On 1/2/15, 4:18 PM, Tom Lane wrote: Heikki Linnakangashlinnakan...@vmware.com writes: On 01/02/2015 11:41 PM, Tom Lane wrote: What might be worth trying is establishing a hard-and-fast boundary between C land and

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2015-01-02 Thread Jim Nasby
On 1/2/15, 4:18 PM, Tom Lane wrote: Heikki Linnakangashlinnakan...@vmware.com writes: On 01/02/2015 11:41 PM, Tom Lane wrote: What might be worth trying is establishing a hard-and-fast boundary between C land and SQL land, with bitwise names in C and bytewise names in SQL. This would mean,

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-31 Thread David Rowley
On 31 December 2014 at 18:20, Robert Haas robertmh...@gmail.com wrote: On Fri, Dec 26, 2014 at 7:57 AM, David Rowley dgrowle...@gmail.com wrote: 1. Do we need to keep the 128 byte aggregate state size for machines without 128 bit ints? This has been reduced to 48 bytes in the patch, which

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-31 Thread Andres Freund
On 2015-01-01 03:00:50 +1300, David Rowley wrote: 2. References to int16 meaning 16 bytes. I'm really in two minds about this, it's quite nice to keep the natural flow, int4, int8, int16, but I can't help think that this will confuse someone one day. I think it'll be a long time

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-31 Thread Robert Haas
On Wed, Dec 31, 2014 at 9:00 AM, David Rowley dgrowle...@gmail.com wrote: Yeah, that's what I was talking about. I'm just looking at the code which uses this size estimate in choose_hashed_grouping(). I'd be a bit worried giving the difference between 48 and 128 that we'd under estimate the

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-30 Thread Robert Haas
On Fri, Dec 26, 2014 at 7:57 AM, David Rowley dgrowle...@gmail.com wrote: 1. Do we need to keep the 128 byte aggregate state size for machines without 128 bit ints? This has been reduced to 48 bytes in the patch, which is in favour code being compiled with a compiler which has 128 bit ints. I

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-26 Thread David Rowley
On 24 December 2014 at 16:04, Andreas Karlsson andr...@proxel.se wrote: On 12/16/2014 11:04 AM, David Rowley wrote: These are some very promising performance increases. I've done a quick pass of reading the patch. I currently don't have a system with a 128bit int type, but I'm working on

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-23 Thread Andreas Karlsson
On 12/22/2014 11:47 PM, Oskari Saarenmaa wrote: __int128_t and __uint128_t are GCC extensions and are not related to stdint.h. [...] These changes don't match what my autoconf does. Not a big deal I guess, but if this is merged as-is the next time someone runs autoreconf it'll write these

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-23 Thread Andreas Karlsson
On 12/16/2014 11:04 AM, David Rowley wrote: These are some very promising performance increases. I've done a quick pass of reading the patch. I currently don't have a system with a 128bit int type, but I'm working on that. Sorry for taking some time to get back. I have been busy before

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-22 Thread Oskari Saarenmaa
On Fri, Nov 14, 2014 at 01:57:16AM +0100, Andreas Karlsson wrote: *** a/configure.in --- b/configure.in *** AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX *** 1751,1756 --- 1751,1759 AC_CHECK_TYPES([int8, uint8, int64, uint64], [], [], [#include stdio.h]) + # Check

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-21 Thread Michael Paquier
On Tue, Dec 16, 2014 at 7:04 PM, David Rowley dgrowle...@gmail.com wrote: It also looks like your OIDs have been nabbed by some jsonb stuff. DETAIL: Key (oid)=(3267) is duplicated. Use src/include/catalog/unused_oids to track the OIDs not yet used in the catalogs when adding new objects for a

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-12-16 Thread David Rowley
On 14 November 2014 at 13:57, Andreas Karlsson andr...@proxel.se wrote: On 11/13/2014 03:38 AM, Alvaro Herrera wrote: configure is a generated file. If your patch touches it but not configure.in, there is a problem. Thanks for pointing it out, I have now fixed it. Hi Andreas, These

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-11-13 Thread Andreas Karlsson
On 11/13/2014 03:38 AM, Alvaro Herrera wrote: configure is a generated file. If your patch touches it but not configure.in, there is a problem. Thanks for pointing it out, I have now fixed it. -- Andreas Karlsson diff --git a/configure b/configure new file mode 100755 index c4f70e8..bb801b4

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-11-13 Thread Peter Eisentraut
On 11/13/14 7:57 PM, Andreas Karlsson wrote: On 11/13/2014 03:38 AM, Alvaro Herrera wrote: configure is a generated file. If your patch touches it but not configure.in, there is a problem. Thanks for pointing it out, I have now fixed it. There is something odd about your patch. I claims

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-11-12 Thread Andreas Karlsson
Hi, Here is version 2 of the patch which detects the presence of gcc/clang style 128-bit integers and has been cleaned up to a reviewable state. I have not added support for any other compilers since I found no documentation 128-bit support with icc or MSVC. I do not have access to any

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-11-12 Thread Andreas Karlsson
On 11/13/2014 02:03 AM, Andreas Karlsson wrote: Here is version 2 of the patch which detects the presence of gcc/clang style 128-bit integers and has been cleaned up to a reviewable state. I have not added support for any other compilers since I found no documentation 128-bit support with icc or

Re: [HACKERS] Using 128-bit integers for sum, avg and statistics aggregates

2014-11-12 Thread Alvaro Herrera
Andreas Karlsson wrote: On 11/13/2014 02:03 AM, Andreas Karlsson wrote: Here is version 2 of the patch which detects the presence of gcc/clang style 128-bit integers and has been cleaned up to a reviewable state. I have not added support for any other compilers since I found no documentation