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.”

PG_BACKEND_PID - Amazon Redshift
This page has not been translated into your language. Request translation

PG_BACKEND_PID

Returns the process ID (PID) of the server process handling the current session.

Note

The PID is not globally unique. It can be reused over time.

Syntax

pg_backend_pid()

Return type

Returns an integer.

Example

You can correlate PG_BACKEND_PID with log tables to retrieve information for the current session. For example, the following query returns the query ID and a portion of the query text for queries completed in the current session.

select query, substring(text,1,40) from stl_querytext where pid = PG_BACKEND_PID() order by query desc; query | substring -------+------------------------------------------ 14831 | select query, substring(text,1,40) from 14827 | select query, substring(path,0,80) as pa 14826 | copy category from 's3://dw-tickit/manif 14825 | Count rows in target table 14824 | unload ('select * from category') to 's3 (5 rows)

You can correlate PG_BACKEND_PID with the pid column in the following log tables (exceptions are noted in parentheses):

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