# slow\_launch\_threads

**URL:** <https://forums.percona.com/t/slow-launch-threads/70>\
**Category:** Other MySQL® Questions\
**Created:** [August 23, 2006, 9:07am UTC](https://forums.percona.com/t/slow-launch-threads/70 "2006-08-23T09:07:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cifroes](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@cifroes](https://forums.percona.com/u/cifroes)\
**Post date:** [August 23, 2006, 9:07am UTC](https://forums.percona.com/t/slow-launch-threads/70/1 "2006-08-23T09:07:07Z")

</div>

Hi,

I’ve noticed that my slow\_launch\_threads is somewhat high (Slow\_launch\_threads 338) and I tried to google for it.

I now understand what this status variable is but I don’t know how to optimize it.

Any tips on what should I do to reduce that number or that’s not important?

±---------------------------±-----------+| Variable\_name | Value |±---------------------------±-----------+| Aborted\_clients | 20852 || Aborted\_connects | 132 || Binlog\_cache\_disk\_use | 0 || Binlog\_cache\_use | 0 || Bytes\_received | 3014728789 || Bytes\_sent | 2798518386 || Com\_admin\_commands | 6010 || Com\_alter\_db | 0 || Com\_alter\_table | 12 || Com\_analyze | 1 || Com\_backup\_table | 0 || Com\_begin | 3 || Com\_change\_db | 1243858 || Com\_change\_master | 0 || Com\_check | 0 || Com\_checksum | 0 || Com\_commit | 1 || Com\_create\_db | 0 || Com\_create\_function | 0 || Com\_create\_index | 0 || Com\_create\_table | 3864 || Com\_dealloc\_sql | 0 || Com\_delete | 211917 || Com\_delete\_multi | 1 || Com\_do | 0 || Com\_drop\_db | 0 || Com\_drop\_function | 0 || Com\_drop\_index | 0 || Com\_drop\_table | 2679 || Com\_drop\_user | 0 || Com\_execute\_sql | 0 || Com\_flush | 3 || Com\_grant | 0 || Com\_ha\_close | 0 || Com\_ha\_open | 0 || Com\_ha\_read | 0 || Com\_help | 0 || Com\_insert | 318836 || Com\_insert\_select | 12629 || Com\_kill | 0 || Com\_load | 0 || Com\_load\_master\_data | 0 || Com\_load\_master\_table | 0 || Com\_lock\_tables | 3 || Com\_optimize | 126 || Com\_preload\_keys | 0 || Com\_prepare\_sql | 0 || Com\_purge | 0 || Com\_purge\_before\_date | 0 || Com\_rename\_table | 0 || Com\_repair | 0 || Com\_replace | 10072 || Com\_replace\_select | 0 || Com\_reset | 0 || Com\_restore\_table | 0 || Com\_revoke | 0 || Com\_revoke\_all | 0 || Com\_rollback | 0 || Com\_savepoint | 0 || Com\_select | 4931474 || Com\_set\_option | 1076 || Com\_show\_binlog\_events | 0 || Com\_show\_binlogs | 7 || Com\_show\_charsets | 52 || Com\_show\_collations | 50 || Com\_show\_column\_types | 0 || Com\_show\_create\_db | 7 || Com\_show\_create\_table | 143 || Com\_show\_databases | 29 || Com\_show\_errors | 0 || Com\_show\_fields | 183 || Com\_show\_grants | 6 || Com\_show\_innodb\_status | 3170 || Com\_show\_keys | 37 || Com\_show\_logs | 0 || Com\_show\_master\_status | 4 || Com\_show\_new\_master | 0 || Com\_show\_open\_tables | 0 || Com\_show\_privileges | 0 || Com\_show\_processlist | 47 || Com\_show\_slave\_hosts | 2 || Com\_show\_slave\_status | 0 || Com\_show\_status | 3194 || Com\_show\_storage\_engines | 0 || Com\_show\_tables | 754 || Com\_show\_variables | 116 || Com\_show\_warnings | 0 || Com\_slave\_start | 0 || Com\_slave\_stop | 0 || Com\_truncate | 4164 || Com\_unlock\_tables | 2 || Com\_update | 1421434 || Com\_update\_multi | 0 || Connections | 2250939 || Created\_tmp\_disk\_tables | 30987 || Created\_tmp\_files | 22617 || Created\_tmp\_tables | 308388 || Delayed\_errors | 0 || Delayed\_insert\_threads | 0 || Delayed\_writes | 0 || Flush\_commands | 2 || Handler\_commit | 0 || Handler\_delete | 276921 || Handler\_discover | 0 || Handler\_read\_first | 148573 || Handler\_read\_key | 309526294 || Handler\_read\_next | 2572335379 || Handler\_read\_prev | 6877680 || Handler\_read\_rnd | 9174977 || Handler\_read\_rnd\_next | 3440247175 || Handler\_rollback | 6 || Handler\_update | 214255498 || Handler\_write | 38552596 || Key\_blocks\_not\_flushed | 0 || Key\_blocks\_unused | 127511 || Key\_blocks\_used | 105948 || Key\_read\_requests | 438621420 || Key\_reads | 886862 || Key\_write\_requests | 10918003 || Key\_writes | 963502 || Max\_used\_connections | 36 || Not\_flushed\_delayed\_rows | 0 || Open\_files | 484 || Open\_streams | 0 || Open\_tables | 256 || Opened\_tables | 42162 || Qcache\_free\_blocks | 968 || Qcache\_free\_memory | 3662088 || Qcache\_hits | 14724632 || Qcache\_inserts | 4800027 || Qcache\_lowmem\_prunes | 1238238 || Qcache\_not\_cached | 119059 || Qcache\_queries\_in\_cache | 2872 || Qcache\_total\_blocks | 8358 || Questions | 51921877 || Rpl\_status | NULL || Select\_full\_join | 67569 || Select\_full\_range\_join | 430 || Select\_range | 319376 || Select\_range\_check | 1018 || Select\_scan | 1866453 || Slave\_open\_temp\_tables | 0 || Slave\_running | OFF || Slave\_retried\_transactions | 0 || Slow\_launch\_threads | 338 || Slow\_queries | 62 || Sort\_merge\_passes | 11318 || Sort\_range | 379840 || Sort\_rows | 190553812 || Sort\_scan | 580587 || Table\_locks\_immediate | 10350296 || Table\_locks\_waited | 2349 || Threads\_cached | 5 || Threads\_connected | 8 || Threads\_created | 10402 || Threads\_running | 1 || Uptime | 1623940 |±---------------------------±-----------+

---

<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:** [August 23, 2006, 9:24am UTC](https://forums.percona.com/t/slow-launch-threads/70/2 "2006-08-23T09:24:31Z")

</div>

Slow launch threads are just threads which took long to launch. This generally happens in case of general system overload as it is pretty simple operations.

In your case you probably need to run EXPLAIN for your queries, stats variables show you have a lot of suboptimal queries.

Example:

| Select\_full\_join | 67569 |

Meaning many joins are done without indexes.

Enable slow query log, set long\_query\_time=2 and enable log\_queries\_not\_using\_indexes and run explain for queries you see in the log.

---

<div class="post-metadata">

**Author:** ![cifroes](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@cifroes](https://forums.percona.com/u/cifroes)\
**Post date:** [August 23, 2006, 10:40am UTC](https://forums.percona.com/t/slow-launch-threads/70/3 "2006-08-23T10:40:20Z")

</div>

Great tips, thanks )

Actually I never noticed that stats before but I will start logging queries not using indexes.

But first I will try to increase my table\_cache to 768 (from 256) and thread\_cache\_size to 40 (from cool:.

Do you know any way to “profile” sql queries besides explain? I need something more detailed to find out if the query is slow because the table it uses needed to be open, if something wasn’t in cache, if the thread creation was slow, etc.

The problem is that I have queries that are perfect (index and not very large \< 1M) and they sometimes take 0.2s and sometimes 0.002s (not real values, just to show the diference in magnitude).

I suspect it can be because of opening tables and of course stuff that isn’t in cache but if I can get some help from a profiling tool, that would be great )

---

<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:** [August 23, 2006, 2:42pm UTC](https://forums.percona.com/t/slow-launch-threads/70/4 "2006-08-23T14:42:45Z")

</div>

Increasing table\_cache is good idea, however your opened\_tables are not high enough for your uptime to hope it will make dramatic improvement.

To profile queries you can use SHOW STATUS, especially if you use MySQL 5.0. Do something like:

FLUSH STATUS;  
  
SHOW STATUS;

And you’ll see statistics increments by this query. I would especially look at Handler\_XX values.

The different times for query are normal on loaded system as load changes plus there can be locks as well as different amount of IO operations to resolve the query.
