# Slow in MEMORY queries

**URL:** <https://forums.percona.com/t/slow-in-memory-queries/1750>\
**Category:** Other MySQL® Questions\
**Created:** [February 8, 2012, 3:01am UTC](https://forums.percona.com/t/slow-in-memory-queries/1750 "2012-02-08T03:01:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris7](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@chris7](https://forums.percona.com/u/chris7)\
**Post date:** [February 8, 2012, 3:01am UTC](https://forums.percona.com/t/slow-in-memory-queries/1750/1 "2012-02-08T03:01:11Z")

</div>

Hi,

I have a dedicated Percona Server (GPL), Release 22.1 server running on 4 core 512 MB RAM Xen VPS. There is only one database session with one table session\_user using MEMORY engine. Please see details below:

show table status from session:\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Name: session\_user Engine: MEMORY Version: 10 Row\_format: Dynamic Rows: 83 Avg\_row\_length: 12587 Data\_length: 1044736Max\_data\_length: 628494084 Index\_length: 399440 Data\_free: 21951728 Auto\_increment: NULL Create\_time: 2011-12-11 12:49:23 Update\_time: NULL Check\_time: NULL Collation: utf8\_general\_ci Checksum: NULL Create\_options: Comment:describe session\_user:±---------------±-------------±-----±----±--------±------+| Field | Type | Null | Key | Default | Extra |±---------------±-------------±-----±----±--------±------+| sess\_id | char(64) | NO | PRI | NULL | || partner\_id | int(11) | NO | MUL | NULL | || web\_product\_id | int(11) | NO | MUL | NULL | || customer\_id | int(11) | NO | MUL | NULL | || user\_id | int(11) | NO | MUL | NULL | || domain | varchar(255) | NO | | NULL | || app | varchar(45) | NO | | NULL | || host | varchar(15) | NO | | NULL | || user\_agent | varchar(255) | NO | | NULL | || sess\_data | longblob | NO | | NULL | || sess\_time | int(11) | NO | | NULL | || created\_at | datetime | NO | | NULL | |±---------------±-------------±-----±----±--------±------+

The table holds around 100-150 records and server is hit by approx. 70 queries per second.

Few times a day I see the following in slow-queries.log:

/usr/sbin/mysqld, Version: 5.5.17-55-log (Percona Server (GPL), Release 22.1). started with:Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sockTime Id Command Argument# Time: 120208 6:41:41# User@Host: 2wima[2wima] @ [192.168.10.5]# Thread\_id: 38784831 Schema: session Last\_errno: 0 Killed: 0# Query\_time: 1.329374 Lock\_time: 0.000073 Rows\_sent: 0 Rows\_examined: 1 Rows\_affected: 1 Rows\_read: 0# Bytes\_sent: 52 Tmp\_tables: 0 Tmp\_disk\_tables: 0 Tmp\_table\_sizes: 0use session;SET timestamp=1328683301;UPDATE session\_user SET sess\_data = ‘symfony/user/sfUser/lastRequest|i:1328683300;symfony/user/sfUser/authenticated|b:1;symfony/user/sfUser/credentials|a:2:{i:0;s:4:"user";i:1;s:6:"Normal";}symfony/user/sfUser/attributes|a:3:{s:30:"symfony/user/sfUser/attributes";a:4:{s:7:"referer";s:0:"";s:8:"currency";s:3:"USD";s:13:"currency\_rate";d:1.3112999999999999101163439263473264873027801513671875;s:10:"partner\_id";i:1;}s:11:"web\_product";a:10:{s:2:"id";i:2;s:5:"theme";s:7:"netserv";s:12:"product\_code";s:1:"c";s:10:"web\_domain";s:15:"dummy.net";s:4:"name";s:15:"Dummy";s:10:"short\_name";s:15:"Dummy";s:15:"default\_culture";s:2:"en";s:8:"has\_blog";b:1;s:15:"active\_cultures";a:2:{i:0;s:2:"en";i:1;s:2:"es";}s:17:"active\_currencies";a:3:{i:0;s:3:"GBP";i:1;s:3:"USD";i:2;s:3:"EUR";}}s:12:"current\_user";a:8:{s:3:"uid";i:00001;s:4:"name";s:8:"DQ three";s:9:"parent\_id";i:00001;s:2:"cc";i:91;s:3:"ext";s:4:"200 1";s:12:"sip\_password";s:6:"secret";s:10:"timeoffset";s:4:"+5.5";s:6:"mobile";N;}}symfony/user/sfUser/culture|s:2:"en";’, sess\_time = 1328683300, host = ‘10.10.10.3’, app = ‘chat-user’ WHERE sess\_id = ‘d1622affzzzzxb6fedzzz560yyyyx1a535f9xyyyx111f971jjjjxaaaa6d8efd6’;

Would anyone be able to offer any suggestions why a simple UPDATE query might be taking 1.3 second to execute? Any ideas how to fix the problem?

Thank you,  
Chris

---

<div class="post-metadata">

**Author:** ![sterin](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@sterin](https://forums.percona.com/u/sterin)\
**Post date:** [February 8, 2012, 6:11am UTC](https://forums.percona.com/t/slow-in-memory-queries/1750/2 "2012-02-08T06:11:25Z")

</div>

chris7 wrote on Wed, 08 February 2012 09:31

> [@](#):
>
> Would anyone be able to offer any suggestions why a simple UPDATE query might be taking 1.3 second to execute?

What is the server doing at that point in time? High CPU or IO? Any backup jobs? Does the syslog contain anything at that point in time?

chris7 wrote on Wed, 08 February 2012 09:31

> [@](#):
>
> Any ideas how to fix the problem?

How often does it occur and is it a real problem??

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [February 8, 2012, 12:38pm UTC](https://forums.percona.com/t/slow-in-memory-queries/1750/3 "2012-02-08T12:38:52Z")

</div>

Use SHOW PROFILES.
