Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

LOG function

Focus mode
LOG function - Amazon Redshift

Returns logarithm of a number.

If you're using this function to calculate the base 10 logarithm, you can also use DLOG10 function.

Syntax

LOG([base, ]argument)

Parameters

base

(Optional) The base of the logarithm function. This number must be positive and can't equal 1. If this parameter is omitted, Amazon Redshift computes the base 10 logarithm of the argument.

argument

The argument of the logarithm function. This number must be positive. If the argument value is 1, the function returns 0.

Return type

The LOG function returns a DOUBLE PRECISION number.

Examples

To find the base 2 logarithm of 100, use the following example.

SELECT LOG(2, 100); +-------------------+ | log | +-------------------+ | 6.643856189774725 | +-------------------+

To find the base 10 logarithm of 100, use the following example. Note that if you omit the base parameter, Amazon Redshift assumes a base of 10.

SELECT LOG(100); +-----+ | log | +-----+ | 2 | +-----+

Next topic:

MOD

Previous topic:

LN

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.