# Logging of prepared statements

**URL:** <https://forums.percona.com/t/logging-of-prepared-statements/4568>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [December 4, 2015, 8:32am UTC](https://forums.percona.com/t/logging-of-prepared-statements/4568 "2015-12-04T08:32:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cblume](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@cblume](https://forums.percona.com/u/cblume)\
**Post date:** [December 4, 2015, 8:32am UTC](https://forums.percona.com/t/logging-of-prepared-statements/4568/1 "2015-12-04T08:32:37Z")

</div>

Hi,

Product: percona-xtradb-cluster-server-5.6 5.6.26-25.12-1.jessie

While debugging i found the following in the logfile while executing a prepared statement:

```auto
mysql> SET &#64;s = 'SELECT SLEEP(5);';
Query OK, 0 rows affected (0.00 sec)

mysql> PREPARE stmt3 FROM &#64;s;
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> EXECUTE stmt3;
+----------+
| SLEEP(5) |
+----------+
| 0 |
+----------+
1 row in set (5.00 sec)

mysql> 

```

This gets printed in the logfile:

```auto
151204 10:58:45 2 Query SET &#64;s = 'SELECT SLEEP(5);'
151204 10:58:47 2 Query PREPARE stmt3 FROM &#64;s
2 Prepare SELECT SLEEP(5)
151204 10:58:53 2 Query EXECUTE stmt3
2 Execute SELECT SLEEP(5)
151204 10:58:58 2 Execute SELECT SLEEP(5)

```

→ “Execute SELECT SLEEP(5)” is printed twice

Here is the output from the logfile of a mysql-server without galera:

```auto
151204 14:02:02 187871 Query SET &#64;s = 'SELECT SLEEP(5);'
151204 14:02:07 187871 Query PREPARE stmt3 FROM &#64;s
187871 Prepare SELECT SLEEP(5)
151204 14:02:10 187871 Query EXECUTE stmt3
151204 14:02:15 187871 Execute SELECT SLEEP(5)

```

→ “Execute SELECT SLEEP(5)” is printed only once

Is this a “feature” from the logging engine or is it really executed twice?

Greetings  
Carsten
