Frage Temporary tables

AWOHille
Posts: 257
Joined: 2011-09-05 09:00

Frage Temporary tables

Post by AWOHille »

Hallo,

eine Sache bekomme ich bei der Optimierung meiner Datenbank nicht so recht in den Griff.

mysqltuner

Code: Select all

 >> MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
 >> Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >> Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.1.63-0+squeeze1
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 140M (Tables: 1163)
[--] Data in InnoDB tables: 12M (Tables: 90)
[--] Data in MEMORY tables: 0B (Tables: 1)
[!!] Total fragmented tables: 154

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 1h 18m 10s (407K q [4.478 qps], 18K conn, TX: 2B, RX: 94M)
[--] Reads / Writes: 79% / 21%
[--] Total buffers: 402.0M global + 11.9M per thread (100 max threads)
[OK] Maximum possible memory usage: 1.6G (20% of installed RAM)
[OK] Slow queries: 0% (0/407K)
[OK] Highest usage of available connections: 26% (26/100)
[OK] Key buffer size / total MyISAM indexes: 64.0M/38.5M
[OK] Key buffer hit rate: 99.4% (1M cached / 7K reads)
[OK] Query cache efficiency: 60.4% (183K cached / 303K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 8K sorts)
[!!] Temporary tables created on disk: 28% (7K on disk / 24K total)
[OK] Thread cache hit rate: 99% (48 created / 18K connections)
[OK] Table cache hit rate: 22% (2K open / 10K opened)
[OK] Open file limit used: 36% (3K/9K)
[OK] Table locks acquired immediately: 99% (149K immediate / 149K locks)
[OK] InnoDB data size / buffer pool: 12.9M/16.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
 Run OPTIMIZE TABLE to defragment tables for better performance
 Enable the slow query log to troubleshoot bad queries
 Temporary table size is already large - reduce result set size
 Reduce your SELECT DISTINCT queries without LIMIT clauses


tuning-primer

Code: Select all

MySQL Version 5.1.63-0+squeeze1 x86_64

Uptime = 1 days 1 hrs 18 min 27 sec
Avg. qps = 4
Total Questions = 407910
Threads Connected = 2

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 407931 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 16
Current threads_cached = 15
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 2
Historic max_used_connections = 26
The number of used connections is 26% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 3 M
Current InnoDB data space = 12 M
Current InnoDB buffer pool free = 3 %
Current innodb_buffer_pool_size = 16 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 456 M
Configured Max Per-thread Buffers : 1.16 G
Configured Max Global Buffers : 146 M
Configured Max Memory Limit : 1.30 G
Physical Memory : 7.69 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 38 M
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 179
Key buffer free ratio = 75 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 20 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 32.06 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 8 M
Current read_rnd_buffer_size = 768 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 7 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 9000 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 4096 tables
Current table_definition_cache = 4096 tables
You have a total of 1277 tables
You have 2392 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 256 M
Current tmp_table_size = 256 M
Of 17794 temp tables, 28% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 41 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 823
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.


Warum werden temporäre Tabellen nicht im Cache ausgelagert, sondern auf der Festplatte?
Top

ddm3ve
Moderator
Moderator
Posts: 1115
Joined: 2011-07-04 10:56

Re: Frage Temporary tables

Post by ddm3ve »

Der Satz erklärt es doch im wesentlichen:

BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.
02:32:12 21.12.2012 und dann sind Deine Probleme alle unwichtig.
Top

AWOHille
Posts: 257
Joined: 2011-09-05 09:00

Re: Frage Temporary tables

Post by AWOHille »

Diese Notiz habe ich irgend wie komplett überlesen. Also ist es generell so, das BLOB und TEXT Felder nicht im RAM gecached werden können?
Top

ddm3ve
Moderator
Moderator
Posts: 1115
Joined: 2011-07-04 10:56

Re: Frage Temporary tables

Post by ddm3ve »

Richtig, und genau die unbedarfte Nutzung solche Datentypen ist dr Grund für das Speichern auf Plate statt dem Cachen im RAM.

Du solltest ggf. prüfen ob Du nicht gelegentlich auf Blobs und TEXT Felder etc. verichten kannst oder dies auf ein minimum reduzieren ggf. aber das DB Design so wählen, dass die notwendigen Feldtypen in möglichst wenigen ggf. zentralisiert in Tabellen vor kommen.
02:32:12 21.12.2012 und dann sind Deine Probleme alle unwichtig.
Top

AWOHille
Posts: 257
Joined: 2011-09-05 09:00

Re: Frage Temporary tables

Post by AWOHille »

Danke erst mal für deine Antwort. Könnte das auch der Grund für eine geringe

Code: Select all

Table cache hit rate: 6% (2K open / 34K opened)


sein?
Top

ddm3ve
Moderator
Moderator
Posts: 1115
Joined: 2011-07-04 10:56

Re: Frage Temporary tables

Post by ddm3ve »

Ja möglicherweise ja.
02:32:12 21.12.2012 und dann sind Deine Probleme alle unwichtig.
Top