one. Preface
We can use it when we want to analyze the performance of a certain SQL.
Profiling is only open since mysql5.0.3 version.
After starting the profile, all queries including incorrect statements will be recorded.
Close the session or set profiling=0 to close it. (If the profiling_history_size parameter is set to 0, it also has the profiling effect of turning off MySQL.)
This tool can be used to query the SQL execution status, how long System lock and Table lock take, etc.,
It is very important to locate the I/O consumption and CPU consumption of a statement. (SQL The two largest resources consumed by statement execution are IO and CPU)
--After mysql5.7, profile information will be gradually abandoned. MySQL recommends using performance schema
two. Process
The simple process is as follows:
##
set profiling=1; //打开分析 run your sql1; run your sql2; show profiles; //查看sql1,sql2的语句分析 show profile for query 1; //查看sql1的具体分析 show profile ALL for query 1; //查看sql1相关的所有分析【主要看i/o与cpu,下边分析中有各项意义介绍】 set profiling=0; //关闭分析
#three. Meaning analysis
##The meaning of the horizontal bar in the above picture
"Status": "query end", status
"Duration": "1.751142", duration
"CPU_user": "0.008999", cpu user
"CPU_system": "0.003999", cpu system
"Context_voluntary": "98", context active switching
"Context_involuntary": "0", context passive switching
"Block_ops_in": "8", blocked input operations
"Block_ops_out": "32", blocked output operations
"Messages_sent": "0 ", Messages sent
"Messages_received": "0", Messages received
"Page_faults_major": "0", Main paging errors
"Page_faults_minor": "0", page faults
"Swaps": "0", number of swaps
"Source_function": "mysql_execute_command", source function
"Source_file": "sql_parse.cc", source file
"Source_line": "4465" Source code line
+------------------- ---+----------+----------+----------------+
The meaning of the vertical column in the above picture
+----------------------+------- ---+----------+----------------+
starting:Start
checking permissions:Checking permissions
Opening tables:Opening tables
init:Initialization
System lock: System lock
optimizing: Optimizing
##statistics: Statistics
##preparing: prepare
executing: execute
Sending data: Sending data
##Sorting result: Sortingend :结束 query end :查询 结束 closing tables : 关闭表 /去除TMP 表 freeing items : 释放物品 cleaning up :清理 +----------------------+----------+----------+------------+ 一般情况下,常用以下语句也就够了 : 以上就是Mysql分析-profile详解的内容,更多相关内容请关注PHP中文网(www.php.cn)!mysql->SHOW profile CPU,BLOCK IO io FOR query 2;

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
