Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding "LOG: execute S_1: BEGIN " in PostgreSQL

I turned on the Postgres logging with 'all' and logs show LOG: execute S_1: BEGIN.

What does S_1 mean?

like image 222
Bhuvan Avatar asked Mar 28 '14 14:03

Bhuvan


1 Answers

The format of this log entry denotes the use of the extended query protocol.

From the linked doc:

In the extended protocol, the frontend first sends a Parse message, which contains a textual query string, optionally some information about data types of parameter placeholders, and the name of a destination prepared-statement object (an empty string selects the unnamed prepared statement)

The S_1 from the log corresponds to that name.

If the application uses the libpq C library or a layer based on it, libpq functions like PQprepare, PQexecPrepared or PQexecParams are built on the extended protocol. On the other hand, the older PQExec uses the simple query protocol only.

like image 146
Daniel Vérité Avatar answered Oct 19 '22 01:10

Daniel Vérité