# SQL Select with nolock keyword

**URL:** <https://forums.percona.com/t/sql-select-with-nolock-keyword/4140>\
**Category:** Other MySQL® Questions\
**Created:** [April 7, 2015, 8:23am UTC](https://forums.percona.com/t/sql-select-with-nolock-keyword/4140 "2015-04-07T08:23:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbgindia](https://avatars.discourse-cdn.com/v4/letter/v/c0e974/32.png) [@vbgindia](https://forums.percona.com/u/vbgindia)\
**Post date:** [April 7, 2015, 8:23am UTC](https://forums.percona.com/t/sql-select-with-nolock-keyword/4140/1 "2015-04-07T08:23:00Z")

</div>

Hi All

I have created a Percona Slave (version 5.1.61-rel13.2) for a MySQL Community Server (5.1.61-log)..

The problem is with the nolock keyword in the select statement and the SLAVE fails at the query. Manuall running the query also fails on the PErcona Slave..

I wanted to upgrade the master to PErcona, but because of this, I might be forced to install MySQL community edition on the slave..

Query output on both servers ==\>

# On Master (MySQL Community Edition) - mysql\> select catid,status from table1 nolock where status=1; ±--------±-----+ | catid | status | ±--------±-----+ | 101 | 1 | | 102 | 1 | | 103 | 1 | | 104 | 1 | | 105 | 1 | | 106 | 1 | ±--------±-----+ 6 rows in set (0.00 sec)

On Slave (PErcona) ==\> mysql\> select catid,status from table1 nolock where status=1;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nolock where status=1

=============

Please help…

---

<div class="post-metadata">

**Author:** ![wagnerbianchi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/wagnerbianchi/32/802_2.png) [@wagnerbianchi](https://forums.percona.com/u/wagnerbianchi)\
**Post date:** [April 7, 2015, 8:53am UTC](https://forums.percona.com/t/sql-select-with-nolock-keyword/4140/2 "2015-04-07T08:53:52Z")

</div>

Not sure about the MySQL support for the keywork or declaration WITH NOLOCK. BTW you can try to work with isolation Modes, interchanging between REPEATABLE\_READ and READ\_UNCOMMITED or even add the IN SHARE MODE to your queries.

=\> [url][https://dev.mysql.com/doc/refman/5.6/en/innodb-consistent-read.html[/url]](https://dev.mysql.com/doc/refman/5.6/en/innodb-consistent-read.html%5B/url%5D)  
=\> [url][https://dev.mysql.com/doc/refman/5.6/en/innodb-locking-reads.html[/url]](https://dev.mysql.com/doc/refman/5.6/en/innodb-locking-reads.html%5B/url%5D)  
=\> [url][http://www.percona.com/blog/2006/08/06/select-lock-in-share-mode-and-for-update/[/url]](http://www.percona.com/blog/2006/08/06/select-lock-in-share-mode-and-for-update/%5B/url%5D)

---

<div class="post-metadata">

**Author:** ![Bohatyaor](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@Bohatyaor](https://forums.percona.com/u/Bohatyaor)\
**Post date:** [April 26, 2016, 6:59am UTC](https://forums.percona.com/t/sql-select-with-nolock-keyword/4140/3 "2016-04-26T06:59:17Z")

</div>

== [URL][http://www.solitaire-champ.com/[/URL]](http://www.solitaire-champ.com/%5B/URL%5D) ==
