PostgreSQL 18 reference · Math Functions

PostgreSQL POWER() Function

Raise a number to a power, so power(2, 10) is 1024. pow() is another name for the same function.

PostgreSQL 18

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

power(a, b)  |  pow(a, b)

Parameters

ParameterDescription
a The base.
b The exponent.

Return value

double precision or numeric.

Examples

Powers and roots
SELECT power(2, 10) AS a, power(9, 0.5) AS b;

Output

  a   |         b
------+--------------------
 1024 | 3.0000000000000000
(1 row)

Run this on your computer — see “Get Started” for setup.

Compound interest
SELECT round(1000 * power(1.05, 10), 2) AS after_10_years;

Output

 after_10_years
----------------
        1628.89
(1 row)

Run this on your computer — see “Get Started” for setup.

In other languages

Was this page helpful?