Portál AbcLinuxu, 10. května 2025 03:23

Dotaz: Mysql - hodně velké hodnoty

24.8.2011 20:02 Tomasekkkk
Mysql - hodně velké hodnoty
Přečteno: 695×
Odpovědět | Admin
Zdravím Vás, právě jsem se díval na statistiky mysql (ver. ), ve statistikách mám:
Handler_read_rnd_next

419.7 G

 Počet požadavků na přečtení dalšího řádku ze souboru. Tato hodnota je vysoká pokud dotazy procházejí celé tabulky, pravděpodobně tedy nemají vhodné indexy. 
a
Handler_read_rnd

1.7 G

 Počet požadavků na přečtení konkrétního řádku tabulky. Vysoká hodnota znamená, že provádíte mnoho dotazů, které vyžadují řazení výsledků. Pravděpodobně používáte mnoho dotazů, které vyžadují prohlížení celé tabulky nebo používáte spojení tabulek, která nevyužívají indexů. 
Což je docela velká hodnota, bohužel jede na serveru databáze několika zákazníků a zasahovat do jejich struktury, indexů apod. nemůžu, lze tyto hodnoty nějak ošetřit, tento problém může nejspíš způsobovat i větší vytížení CPU atp.

Jinak celková statistika mysql (vynulována cca. před hodinkou):
ø za hodinu

Přijato

39.9 GiB

38.5 MiB

Odesláno

26.4 TiB

25.5 GiB
 


Celkem

26.5 TiB

25.6 GiB
 



Připojení

ø za hodinu

%
 

Maximum současných připojení

12 

--- 

--- 


Nepovedených pokusů

7 

6.61 m

0.00%
 


Přerušené

0 

0.00 

0.00%
 


Celkem

12 M

10.95 k

100.00%

Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

MMMMMMMMM avatar 24.8.2011 20:23 MMMMMMMMM | skóre: 44 | blog: unstable | Valašsko :-)
Rozbalit Rozbalit vše Re: Mysql - hodně velké hodnoty
Odpovědět | | Sbalit | Link | Blokovat | Admin
spusť si mysqltuner a uvidíš, co ti doporučuje
Linux Dokumentační Projekt - PDF ke stažení
24.8.2011 20:27 Tomasekkkk
Rozbalit Rozbalit vše Re: Mysql - hodně velké hodnoty
Ano to jsem pustil, bohužel stále radí a nedaří se to vytunit :-( Už jsem bezradný .. :-(
24.8.2011 20:33 Tomasekkkk
Rozbalit Rozbalit vše Re: Mysql - hodně velké hodnoty

[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.49-3-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2G (Tables: 2033)
[--] Data in InnoDB tables: 4M (Tables: 306)
[--] Data in MEMORY tables: 0B (Tables: 17)
[!!] Total fragmented tables: 338

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 10s (3K q [392.000 qps], 937 conn, TX: 1M, RX: 258K)
[--] Reads / Writes: 98% / 2%
[--] Total buffers: 74.0M global + 2.7M per thread (200 max threads)
[OK] Maximum possible memory usage: 624.0M (10% of installed RAM)
[OK] Slow queries: 0% (0/3K)
[OK] Highest usage of available connections: 2% (4/200)
[!!] Key buffer size / total MyISAM indexes: 16.0M/1.6G
[!!] Key buffer hit rate: 94.1% (58K cached / 3K reads)
[OK] Query cache efficiency: 24.0% (690 cached / 2K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 53 sorts)
[!!] Temporary tables created on disk: 50% (307 on disk / 614 total)
[OK] Thread cache hit rate: 99% (4 created / 937 connections)
[!!] Table cache hit rate: 1% (256 open / 22K opened)
[OK] Open file limit used: 50% (516/1K)
[OK] Table locks acquired immediately: 99% (1K immediate / 1K locks)
[OK] InnoDB data size / buffer pool: 4.9M/8.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    key_buffer_size (> 1.6G)
    tmp_table_size (> 32M)
    max_heap_table_size (> 32M)
    table_cache (> 256)

Mé nastavení:
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
set-variable=local-infile=0
#  Doplneni kvuli fulltextu min hledanych slov a max hledanych slov

ft_min_word_len = 2


#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir		= /usr
datadir = /var/lib/mysql
tmpdir		= /tmp
#language	= /usr/share/mysql/english
language	= /usr/share/mysql/czech
init-connect='SET NAMES cp1250'
default-character-set = cp1250
collation-server = cp1250_general_ci
#collation_server = cp1250_czech_cs
skip-external-locking


#### Nastaveni z 24.8.2011

skip-name-resolve
skip-locking
skip-host-cache

tmp_table_size = 32M
join_buffer_size = 256K
max_heap_table_size = 32M





#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address		= 127.0.0.1
#
#
# * Fine Tuning
#
key_buffer		= 16M
max_allowed_packet	= 16M
thread_stack		= 128K
thread_cache_size	= 8
##### Max connetion bzlo yakomentovane a bzlo max 151
max_connections        = 200
interactive_timeout	= 20000
wait_timeout	= 20000
#### Table cache bylo zakomentovane musi byt vic jak 64
table_cache            = 256
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M





#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log		= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries	= /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
#server-id		= 1
log_bin			= /var/log/mysql/mysql-bin.log
# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
expire_logs_days	= 4
max_binlog_size         = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
#skip-bdb
big-tables
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
key_buffer		= 16M
sort_buffer_size = 16M
read_buffer = 2M
write_buffer = 2M 

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
#
!includedir /etc/mysql/conf.d/

24.8.2011 20:32 Kit
Rozbalit Rozbalit vše Re: Mysql - hodně velké hodnoty
Odpovědět | | Sbalit | Link | Blokovat | Admin
Jestliže se na 12 M připojení přečetlo 420 G záznamů, tak mi to vychází průměrných 35 k přečtených záznamů na jedno připojení. To je kousek za hranicí vhodnosti/nevhodnosti indexů. Bylo by asi lepší indexovat, pokud je co. Záleží také na velikosti tabulek. Pokud se sekvenčně procházená tabulka vejde celá do cache, tak to tolik vadit nemusí.
24.8.2011 20:35 Tomasekkkk
Rozbalit Rozbalit vše Re: Mysql - hodně velké hodnoty
Indexovat bych indexoval, ale co udělat se zákazníkovou databází, špárat do ní nemůžu :-(

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.