Re: [HACKERS] pow support for pgbench

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Raúl Marín Rodríguez <rmrodriguez(at)carto(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] pow support for pgbench
Date: 2017-12-05 13:00:09
Message-ID: alpine.DEB.2.20.1712051355450.7660@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> I've been giving a thought about this and I think we could reach the
> compromise
> of having a single function with 2 overloads:
> * pow(double, double) -> double: Uses C pow().
> * pow(int, int) -> double: Uses ipow() for positive exponents, and pow()
> for negative exponents.
>
> In both cases we'd return a double but we use the fast ipow if it's
> possible (which can be 20x faster), so at the cost of an extra cast if
> you need an int, we'd have a consistent API. Would this be acceptable?

This is for Robert to say whether it is more acceptable to him.

My 0.02€: ISTM that it closely equivalent to having just the double
version and using an explicit cast to get an int if needed, which does not
conform anymore to strict SQL behavior than the previous compromise.

Also, probably having something (anything) is better than nothing.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2017-12-05 13:02:52 Re: [HACKERS] [POC] Faster processing at Gather node
Previous Message Raúl Marín Rodríguez 2017-12-05 12:44:04 Re: [HACKERS] pow support for pgbench