亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 3094 | 回復(fù): 0
打印 上一主題 下一主題

MySql 100120:MySQL Optimization 優(yōu)化(2/2) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2010-01-20 13:49 |只看該作者 |倒序?yàn)g覽


  Normal
  0
  
  7.8 磅
  0
  2
  
  false
  false
  false
  
   
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4



/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:普通表格;
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";
        mso-ansi-language:#0400;
        mso-fareast-language:#0400;
        mso-bidi-language:#0400;}
MySql 100120:MySQL Optimization 優(yōu)化(2/2)
@ http://zcatt.cublog.cn
1.   
Optimizing DB Structure
1.1 Make your Data as Small as Possible
1)Use the smallest data type possible.
2) Declare columns to be NOT NULL if
possible
3) The primary index of a table should be short
as possible.
4) Create only the indexes that you really
need.
5) If it is very likely that a string
column has a unique prefix on the first number of characters, it is better to
index only this prefix, using MySQL's support for creating an index on the
leftmost part of the column.
6)In some circumstances, it can be
beneficial to split into two a table that is scanned very often.

1.2 Column Indexes
Use of indexes on the relevant columns is
the best way to improve the performance of SELECT operations.
With col_name(N) syntax in an index
specification, you can create an index that uses only the first N characters of
a string column.
CREATE
TABLE test (blob_col BLOB, INDEX(blob_col(10)));

You can also create FULLTEXT index. Only
the MyISAM storage engine supports FULLTEXT indexes for CHAR, VARCHAR, and TEXT
columns.

1.3 Multiple-Column Indexes
MySQL can create composite indexes. An
index may consist of up to 16 columns.
A multiple-column index can be considered a
sorted array containing values that ar created by concatenating the values of
the indexed columns.
MySQL uses multiple-column indexes
in such a way that queries are fast when you specify a known quantity for the
first columnof the index in a WHERE clause, even if you do not specify values
for the other columns. For example, if you have a three-column index on (col1,
col2, col3), you have indexed search capabilities on (col1), (col1,col2), and
(col1, col2, col3).

1.4 How MySQL Uses Indexes
MySQL uses indexes for these operations:
1)     
To find the rows matching a
WHERE clause quickly.
2) To eliminate rows from consideration.
3) To retrieve rows from other tables when
performing joins. MySQL can use indexes on columns more efficiently if they are
declared as the same type and size.
4) To finde the MIN() or MAX() value for a
specific indexed column key_col.
5) To sort or group a table if the sorting
or grouping is done on a leftmost prefix of a usable key.
6) In some cases, a query can be optimized
to retrieve values without consulting the data rows.

1.5 The MyISAM Key Cache
To minimize disk I/O, the MyISAM storage
engine employs a cache mechanism to keep the most frequently accessed table
blocks in memory: for index blocks and data blocks.

To control the size of the key cache, use
the key_buffer_size system variable.

Threads can shared access key cache buffers
simultaneously.

MySQL also provides multiple key caches.
This feature enables you to assign different table indexes to different key
caches.

Manual suggests a busy server should
maintain three key caches: hot, cold,and warm.

If there are enough blocks in a key cache
to hold blocks of an entire index, or at least the blocks corresponding to its
nonleaf nodes, it makes sense to preload the key cache with index blocks before
starting to use it. To preload an index into a cache, use the LOAD INDEX INTO
CACHE statement. For example,
mysql>
LOAD INDEX INTO CACHE t1,t2 IGNORE LEAVES;


1.6 The InnoDB Buffer Pool
InnoDB maintains a buffer pool for caching
data and indexes in memory. InnoDB manages the pool as a list, using a LRU
algorithm incorporating a midpoint insertion strategy.

1.7 How MySQL Opens and Close Tables
MySQL is multi-threaded, so there may be
many clients issuing queries for a given table simultaneously. To minimize the
problem with multiple client sessions having different states on the same
table, the table is opened independently by each concurrent session.

2. Optimizing the MySQL Server
2.1 How Compiling and Linking Affects the Speed of MySQL
2.2 System Factors and Startup Parameter Tuning
2.3 Tuning Server Parameters
shell>
mysqld --verbose --help


This command produces a list of all mysqld
options and configurable system variables. These commands can also list some
parameters.

mysql>
SHOW VARIABLES;

mysql>
SHOW STATUS;

shell>
mysqladmin variables

shell>
mysqladmin extended-status
























               
               
               

本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/8866/showart_2154726.html
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP