# Surprising: Where a quote usage dramatically slows down a request

**URL:** <https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433>\
**Category:** Other MySQL® Questions\
**Created:** [September 4, 2007, 7:03am UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433 "2007-09-04T07:03:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdeluca](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@sdeluca](https://forums.percona.com/u/sdeluca)\
**Post date:** [September 4, 2007, 7:03am UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433/1 "2007-09-04T07:03:23Z")

</div>

Hi there,

I wanted to subtmit a weird finding while optimizing our backend access (MySql 5.0.32-Debian\_7etch1-log).

I have a table with the primary indexed column user\_id (mediumint ( 8 )).

With the following code, we update some user’s infos:

UPDATE phpbb\_users SET flastcellupload = ‘1188382472’ , fidcell=‘10459’ WHERE user\_id = ‘10915207’;Query OK, 0 rows affected (3.38 sec)Rows matched: 0 Changed: 0 Warnings: 0

Note that user\_id 10915207 does not exists (and card(user\_id)=670+K).

This request takes 3+s to be executed.

And what if I remove the quote around the number, as follows?:

UPDATE phpbb\_users SET flastcellupload = ‘1188382472’ , fidcell=‘10459’ WHERE user\_id = 10915207;Query OK, 0 rows affected (0.00 sec)Rows matched: 0 Changed: 0 Warnings: 0

As you can see, it takes almost nothing to perform.

I ran some similar tests on SELECT and I can say it has no effect (very quick in both syntaxex).

Any toughts?

Thanks in advance,  
Sdl

---

<div class="post-metadata">

**Author:** ![srynonick](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@srynonick](https://forums.percona.com/u/srynonick)\
**Post date:** [September 4, 2007, 1:46pm UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433/2 "2007-09-04T13:46:44Z")

</div>

i don’t know why its faster on select, but user\_id is a number, integer, and therefore it shouldnt be user\_id=‘x’ but user\_id=x, as ‘x’ means a string.

---

<div class="post-metadata">

**Author:** ![sdeluca](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@sdeluca](https://forums.percona.com/u/sdeluca)\
**Post date:** [September 4, 2007, 6:06pm UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433/3 "2007-09-04T18:06:23Z")

</div>

thx srynonick for your answer. But I’m afraid a SQL query is by essence a string. So I dono why putting single quote should slow down that way.

And, btw, I forgot to mention that the update does not suffer from slow down if I use an user\_id which is smaller (for ex 600000).

Does it have to do with mediumint?

---

<div class="post-metadata">

**Author:** ![srynonick](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@srynonick](https://forums.percona.com/u/srynonick)\
**Post date:** [September 5, 2007, 2:25am UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433/4 "2007-09-05T02:25:54Z")

</div>

maybe mysql isn’ that intelligent an makes a conversion to int (the value) or the content of the row (to string) on every row.

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [September 5, 2007, 8:46am UTC](https://forums.percona.com/t/surprising-where-a-quote-usage-dramatically-slows-down-a-request/433/5 "2007-09-05T08:46:57Z")

</div>

Is it 100% repeatable ?  
(It could be first update was just uncached)

If yes take a look at Handler\_XXX increments while running first and second query

If they are different file a bug with MySQL.

String-\>Number conversion should work fine as it is deterministic.  
It is Number-\>String which usually slow things down.
