PostgreSQL Operator – What Does the Vertical Pipe Slash Operator Do?

operatorpostgresql

I'm wondering what pipe slash |/ does in,

SET equal_area_radius = |/area/pi();

The statement works and it definitely changes the value:

SELECT |/125.555/pi(); --  returns: 6.32181918120139
SELECT 125.555/pi();   --  returns: 39.9653977598058

What does the pipe-slash operator |/ do?

Best Answer

The |/ operator calculates the square root

postgres>  select |/16,  sqrt(16);
 ?column? | sqrt
----------+------
        4 |    4
(1 row)

So |/125.555/pi() is equivalent to sqrt(125.555/pi())