Mysql´æ´¢¹ý³Ì£¨Èý£©——´¦Àí·ÖÒ³
·ÖÒ³¹¦ÄÜÔÚÈκÎÓ¦ÓÃÖж¼±È½Ï³£¼û£¬¶ø
Mysql
µÄ´æ´¢¹ý³Ì·ÖÒ³±ØÐëͨ¹ý¶¯Ì¬
sql
À´Ö´ÐС£·ÖÒ³¶ÔÓ¦µÄ
offset
ºÍ
row_count
±ØÐëÏÈÓÃ
concat
º¯Êý±ä³É×Ö·û´®×é×°µ½
sql
ÖУ¨ÈçÓï¾ä
1
£©£¬¶ø²»ÄÜÖ±½ÓʹÓã¨ÈçÓï¾ä
2
£¬
Mysql
²»Ö§³Ö£©¡£
Mysql
·ÖÒ³¹¦ÄܵÄʵÏÖÈçÏ´úÂëËùʾ£º
Sql
code 3-1:
CREATE PROCEDURE test_proc_multi_select(IN i_pageIndex INT, IN i_pageSize INT)
BEGIN
declare stmt varchar(2000);
set @sql = concat('select * from testproc limit ',(i_pageIndex-1) * i_pageSize,' , ',i_pageSize); -- Óï¾ä1×é×°sql
prepare stmt from @sql; -- µÃµ½prepare stmt
execute stmt; -- Ö´ÐÐselect
-- ////ÒÔÏ·½Ê½±àÒë²»ÄÜͨ¹ý£¡
-- select * from testproc limit (i_pageIndex-1)*i_pageSize,i_pageSize; -- Óï¾ä2
END
ÒÔÏ´úÂëÌṩÁË´ø
where
Ìõ¼þµÄ·ÖÒ³£º
Sql
code 3-2:
CREATE PROCEDURE test_proc_param_select(IN i_name VARCHAR(100),IN i_pageIndex INT, IN i_pageSize INT)
BEGIN
declare stmt varchar(2000);
set @sql = concat('select * from testproc where name like ''%',i_name,'%'' limit ',(i_pageIndex-1) * i_pageSize,',',i_pageSize); --×¢ÒâlikeºóÁ½¸öµ¥ÒýºÅ±íʾһ¸ö¡£
prepare stmt from @sql;
execute stmt;
END;
Ïà¹ØÎĵµ£º
ÔÚmenzhi007µÄblogÀï¿´µ½·Ç³£ÓÐÒâ˼µÄ¶«Î÷£ºhttp://hi.baidu.com/menzhi007/blog/item/c2e98551a18754848c54301c.html
ÔÚmysqlÊÖ²áÀ
http://www.phpchina.com/manual/mysql/functions.html#comparison-operators
MySQL°´ÕÕÒÔϹæÔò½øÐÐÊýÖµ±È½Ï£º
ÈôÓÐÒ»¸ö»òÁ½¸ö²ÎÊýΪ NULL£¬³ý·ÇNULL-safe <=> µÈËã·û£¬Ôò±È ......
Why you should ignore MySQL’s key cache hit ratio
http://www.mysqlperformanceblog.com/2010/02/28/why-you-should-ignore-mysqls-key-cache-hit-ratio/
²»ÒªÏàÐÅmysqlµÄkey cache hit ratio£º
key cache hit ratio = 1 - key_reads / key_read_requests
key_reads:´Ó´ÅÅÌÖжÁ¿éµÄÊýÁ¿
key_read_request ......
½ñÌìÖØÐÂ×°ÁËÒ»ÏÂmysqlÊý¾Ý¿â£¬½ØÖ¹µ½ÏÖÔÚÒѺÄʱ2£º30£¬ÓôÃÆ£¡£¡£¡£¡£¨ÎÒÔÀ´²»ÖªµÀ×°¹ý¶àÉÙ´Îmysql£©
ËùÒÔÎÒ¾ö¶¨£¬°Ñ¹ØÓÚmysqlÊý¾Ý¿âµÄ³õʼ»¯²Ù×÷½éÉÜÒ»ÏÂ
£º
1.°²×°mysqlÊý¾Ý¿â
http://www.duote.com/tech/1/2430_1.html
......
¶ÔÓÚÈκÎÒ»¸öÊý¾Ý¿â¹ÜÀíϵͳÀ´Ëµ£¬ÄÚ´æµÄ·ÖÅäʹÓþø¶Ô¿ÉÒÔËãµÄÉÏÊÇÆäºËÐÄÖ®Ò»ÁË£¬ËùÒԺܶàÏ£Íû¸üΪÉîÈëÁ˽âijÊý¾Ý¿â¹ÜÀíϵͳµÄÈË£¬¶¼»áÏ£ÍûÒ»¿ú¾¿¾¹£¬ÎÒÒ²²»ÀýÍâ¡£
´ÓÄÚ´æµÄʹÓ÷½Ê½MySQL Êý¾Ý¿âµÄÄÚ´æʹÓÃÖ÷Òª·ÖΪÒÔÏÂÁ½Àà
* Ï̶߳ÀÏíÄÚ´æ
* È«¾Ö¹²ÏíÄÚ´æ
½ñÌìÕâƪÎÄÕÂÔÝʱÏÈ·ÖÎö MySQL ÖÐÖ÷ÒªµÄ “Ï̶߳ÀÏíÄ ......
³£ÓÃmysqlÃüÁîÐÐÃüÁî
¡¡¡¡1 .mysqlµÄÆô¶¯ÓëÍ£Ö¹
¡¡¡¡Æô¶¯MYSQL·þÎñ net start mysql
¡¡¡¡Í£Ö¹MYSQL·þÎñ net stop mysql
¡¡¡¡2 . netstat –na | findstr 3306 ²é¿´±»¼àÌýµÄ¶Ë¿Ú , findstrÓÃÓÚ²éÕÒºóÃæµÄ¶Ë¿ÚÊÇ·ñ´æÔÚ
¡¡¡¡3 . ÔÚÃüÁîÐÐÖеǽMYSQL¿ØÖÆ̨ , ¼´Ê¹Óà MYSQL COMMEND LINE TOOL
¡¡¡¡ Óï·¨¸ñʽ ......