From: Johan De Meersman Date: February 1 2010 2:16pm Subject: Re: Is table_open_cache a private cache of a session? List-Archive: http://lists.mysql.com/mysql/220522 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e647eb4a739df5047e8aa2f6 --0016e647eb4a739df5047e8aa2f6 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 1, 2010 at 2:21 PM, Cui Shijun wrote: > "To minimize the problem with multiple client sessions having > different states on the same table, the table is opened independently > by each concurrent session." > That literally means that every time a table gets referenced, it is "opened" anew. Even if you use the same table twice in a single select, it gets opened twice. > Are sessions using private table caches? > No, as far as I understand the internals there's a global cache, and as soon as a table is no longer in use, the object gets returned for subsequent use by another thread (or free()ing if there's not enough room for something else). > if I have M concurrent sessions and N tables, assume each session > will access tables one by one, will mysql open M*N tables? > Yes, this is correct. This also implies that you need to make sure your system allows sufficient filehandles for the MySQL user/process. Table cache objects don't really use a lot of space, so feel free to set it to a large enough value. I've got hosts where it's set to 30.000, although it's quite rare that they ever get there - I've had one occurrence where it grew to 26.000 open tables, with up to 20 tables being opened per second. Graph it (Open_tables variable) and make sure you don't run into the limit. -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel --0016e647eb4a739df5047e8aa2f6--