{"id":455556,"date":"2025-04-11T09:12:03","date_gmt":"2025-04-11T09:12:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=455556"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=455556","title":{"rendered":"<span>\u0420\u0430\u0441\u043a\u0440\u0430\u0441\u043a\u0430 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b T-SQL \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0442\u0440\u0438\u043a<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0436\u0443, \u043e \u0447\u0435\u043c \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043c \u044d\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39e\/9cd\/b26\/39e9cdb26aa46da32cae7478628dd793.png\" width=\"567\" height=\"437\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/39e\/9cd\/b26\/39e9cdb26aa46da32cae7478628dd793.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39e\/9cd\/b26\/39e9cdb26aa46da32cae7478628dd793.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c Tsql \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043c\u044b \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 (x), cpu \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (c), duration \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (d), \u0447\u0438\u0441\u043b\u043e \u0447\u0442\u0435\u043d\u0438\u0439 (r), \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (w), \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 @@rowcount (n)<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u044b<\/p>\n<h2>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 SQL profiler \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>SP:StmtCompleted<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>CPU<\/p>\n<\/li>\n<li>\n<p>Duration<\/p>\n<\/li>\n<li>\n<p>Reads<\/p>\n<\/li>\n<li>\n<p>Writes<\/p>\n<\/li>\n<li>\n<p>StartTime<\/p>\n<\/li>\n<li>\n<p>EndTime<\/p>\n<\/li>\n<li>\n<p>LineNumber<\/p>\n<\/li>\n<li>\n<p>ObjectName<\/p>\n<\/li>\n<li>\n<p>SPID<\/p>\n<\/li>\n<li>\n<p>RowCounts<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 RowCounts \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e TextData.<\/p>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 ObjectName = \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u0418\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0441\u0445\u0435\u043c\u044b \u0438 \u0441\u043a\u043e\u0431\u043e\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b [dbo].[MyProc] \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e MyProc<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0430 dev \u0438 \u0437\u043d\u0430\u0435\u0442\u0435 SPID, \u0442\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0435\u0433\u043e. \u0414\u043b\u044f Production \u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c SPID, \u0445\u043e\u0442\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u041c\u0435\u043d\u044f \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e SQL profiler, \u0430 \u043d\u0435 Extended Events. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0445. \u0414\u043b\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 ad hoc \u0442\u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0435\u0439\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL profiler. \u041d\u0430 production, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c runaway trace.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0440\u0435\u0439\u0441\u0430 \u0441\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0438\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0412\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Python. \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 pygments <a href=\"https:\/\/pygments.org\/\" rel=\"noopener noreferrer nofollow\">Welcome! \u2014 Pygments<\/a>  :<\/p>\n<p><strong>pip install Pygments<\/strong><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430 pygmentize. \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<p><a href=\"https:\/\/github.com\/tzimie\/sqlpig\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tzimie\/sqlpig<\/a><\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u043b\u0441\u044f SQLpyg (SQL + pygmentize), \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 SQLpig. <\/p>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 sqlpig.py \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"sql\">select ObjectName+'.sql:'+convert(varchar,LineNumber)+':'+   convert(varchar,cnt)+':'+   convert(varchar,CPU)+':'+   convert(varchar,Duration)+':'+   convert(varchar,Reads)+':'+   convert(varchar,Writes)+':'+   convert(varchar,isnull(RowCounts,0)) from (   select ObjectName,LineNumber, count(*) as cnt, sum(CPU) as CPU,sum(Duration) as Duration,     sum(Reads) as Reads, sum(Writes) as Writes, sum(RowCounts) as RowCounts   from {MyTrace} where EventClass=45 and ObjectName is not null   group by ObjectName,LineNumber) Q <\/code><\/pre>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 {MyTrace} \u043d\u0430 \u0438\u043c\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u0443\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0440\u0435\u0439\u0441. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434 \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b (.log). \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <em>short, <\/em>long \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u0412 Management Studio \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 Alter \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432 \u0444\u0430\u0439\u043b <em>\u0438\u043c\u044f\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b.<\/em>sql<\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/132\/de7\/974\/132de79749a788737a91583cd5b77e3f.png\" width=\"618\" height=\"514\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/132\/de7\/974\/132de79749a788737a91583cd5b77e3f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/132\/de7\/974\/132de79749a788737a91583cd5b77e3f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0432\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 &#8212; ALTER \u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c &#8212; \u0430 \u043f\u043e\u0447\u0435\u043c\u0443, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438 \u0442\u0440\u0435\u0439\u0441? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0440\u0435\u0439\u0441 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 production, \u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u0449\u0438\u043c \u0432\u0441\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 \u043a\u043e\u043c\u043f \u0447\u0435\u0440\u0435\u0437 copy\/paste (\u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d)<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c sqlpig:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/412\/c4a\/1a1\/412c4a1a1ad386348eefd4526d799314.png\" width=\"814\" height=\"319\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/412\/c4a\/1a1\/412c4a1a1ad386348eefd4526d799314.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/412\/c4a\/1a1\/412c4a1a1ad386348eefd4526d799314.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 <strong>myproc.log<\/strong> \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0444\u0430\u0439\u043b<strong> myproc.sql <\/strong>\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 <strong>myproc.html.<\/strong> \u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>x &#8212; \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439, \u043d\u0435 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d \u0432 \u0446\u0438\u043a\u043b\u0435, \u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>c &#8212; CPU \u0432 ms<\/p>\n<\/li>\n<li>\n<p>d &#8212; duration \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e, \u0447\u0435\u043c CPU)<\/p>\n<\/li>\n<li>\n<p>r &#8212; Reads<\/p>\n<\/li>\n<li>\n<p>w &#8212; Writes<\/p>\n<\/li>\n<li>\n<p>n &#8212; \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 RowCounts (\u043e\u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u0435 \u0438 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430)<\/p>\n<\/li>\n<li>\n<p>XCDRWN &#8212; uppercase \u043c\u0435\u0442\u0440\u0438\u043a\u0438 &#8212; \u044d\u0442\u043e \u0442\u0435 \u0436\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043a \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u044b\u0435, \u0442\u0430\u043a \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, xcCdD \u0432\u0430\u043b\u0438\u0434\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212; \u044d\u0442\u043e \u0438\u043c\u044f log \u0444\u0430\u0439\u043b\u0430. \u041a \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u0443 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c84\/e3a\/bd4\/c84e3abd4d266ac92474245c6830bcba.png\" width=\"805\" height=\"325\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c84\/e3a\/bd4\/c84e3abd4d266ac92474245c6830bcba.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c84\/e3a\/bd4\/c84e3abd4d266ac92474245c6830bcba.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h2>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043a\u0438 \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0449\u0443 \u043a\u0440\u0430\u0435\u0432\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u043f\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<p>shift = 1 # edit this value to readjust position if needed<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/897282\/\"> https:\/\/habr.com\/ru\/articles\/897282\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0436\u0443, \u043e \u0447\u0435\u043c \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043c \u044d\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c Tsql \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043c\u044b \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 (x), cpu \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (c), duration \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (d), \u0447\u0438\u0441\u043b\u043e \u0447\u0442\u0435\u043d\u0438\u0439 (r), \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (w), \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 @@rowcount (n)<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u044b<\/p>\n<h2>\u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 SQL profiler \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>SP:StmtCompleted<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>CPU<\/p>\n<\/li>\n<li>\n<p>Duration<\/p>\n<\/li>\n<li>\n<p>Reads<\/p>\n<\/li>\n<li>\n<p>Writes<\/p>\n<\/li>\n<li>\n<p>StartTime<\/p>\n<\/li>\n<li>\n<p>EndTime<\/p>\n<\/li>\n<li>\n<p>LineNumber<\/p>\n<\/li>\n<li>\n<p>ObjectName<\/p>\n<\/li>\n<li>\n<p>SPID<\/p>\n<\/li>\n<li>\n<p>RowCounts<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 RowCounts \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e TextData.<\/p>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 ObjectName = \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u0418\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0441\u0445\u0435\u043c\u044b \u0438 \u0441\u043a\u043e\u0431\u043e\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b [dbo].[MyProc] \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e MyProc<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0430 dev \u0438 \u0437\u043d\u0430\u0435\u0442\u0435 SPID, \u0442\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0435\u0433\u043e. \u0414\u043b\u044f Production \u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c SPID, \u0445\u043e\u0442\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u041c\u0435\u043d\u044f \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e SQL profiler, \u0430 \u043d\u0435 Extended Events. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0445. \u0414\u043b\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 ad hoc \u0442\u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0435\u0439\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL profiler. \u041d\u0430 production, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c runaway trace.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0440\u0435\u0439\u0441\u0430 \u0441\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0438\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0412\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Python. \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 pygments <a href=\"https:\/\/pygments.org\/\" rel=\"noopener noreferrer nofollow\">Welcome! \u2014 Pygments<\/a>  :<\/p>\n<p><strong>pip install Pygments<\/strong><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430 pygmentize. \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 \u043c\u043e\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<p><a href=\"https:\/\/github.com\/tzimie\/sqlpig\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tzimie\/sqlpig<\/a><\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u043b\u0441\u044f SQLpyg (SQL + pygmentize), \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 SQLpig. <\/p>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 sqlpig.py \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"sql\">select ObjectName+'.sql:'+convert(varchar,LineNumber)+':'+   convert(varchar,cnt)+':'+   convert(varchar,CPU)+':'+   convert(varchar,Duration)+':'+   convert(varchar,Reads)+':'+   convert(varchar,Writes)+':'+   convert(varchar,isnull(RowCounts,0)) from (   select ObjectName,LineNumber, count(*) as cnt, sum(CPU) as CPU,sum(Duration) as Duration,     sum(Reads) as Reads, sum(Writes) as Writes, sum(RowCounts) as RowCounts   from {MyTrace} where EventClass=45 and ObjectName is not null   group by ObjectName,LineNumber) Q <\/code><\/pre>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 {MyTrace} \u043d\u0430 \u0438\u043c\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u0443\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0440\u0435\u0439\u0441. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434 \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b (.log). \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <em>short, <\/em>long \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b. \u0412 Management Studio \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 Alter \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432 \u0444\u0430\u0439\u043b <em>\u0438\u043c\u044f\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b.<\/em>sql<\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0435\u0440\u0432\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 &#8212; ALTER \u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c &#8212; \u0430 \u043f\u043e\u0447\u0435\u043c\u0443, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438 \u0442\u0440\u0435\u0439\u0441? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0440\u0435\u0439\u0441 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 production, \u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u0449\u0438\u043c \u0432\u0441\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 \u043a\u043e\u043c\u043f \u0447\u0435\u0440\u0435\u0437 copy\/paste (\u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d)<\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c sqlpig:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 <strong>myproc.log<\/strong> \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0444\u0430\u0439\u043b<strong> myproc.sql <\/strong>\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 <strong>myproc.html.<\/strong> \u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>x &#8212; \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439, \u043d\u0435 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d \u0432 \u0446\u0438\u043a\u043b\u0435, \u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>c &#8212; CPU \u0432 ms<\/p>\n<\/li>\n<li>\n<p>d &#8212; duration \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e, \u0447\u0435\u043c CPU)<\/p>\n<\/li>\n<li>\n<p>r &#8212; Reads<\/p>\n<\/li>\n<li>\n<p>w &#8212; Writes<\/p>\n<\/li>\n<li>\n<p>n &#8212; \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 RowCounts (\u043e\u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u0435 \u0438 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430)<\/p>\n<\/li>\n<li>\n<p>XCDRWN &#8212; uppercase \u043c\u0435\u0442\u0440\u0438\u043a\u0438 &#8212; \u044d\u0442\u043e \u0442\u0435 \u0436\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445 \u043a \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u044b\u0435, \u0442\u0430\u043a \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, xcCdD \u0432\u0430\u043b\u0438\u0434\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212; \u044d\u0442\u043e \u0438\u043c\u044f log \u0444\u0430\u0439\u043b\u0430. \u041a \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u0443 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043a\u0438 \u0441 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0449\u0443 \u043a\u0440\u0430\u0435\u0432\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u043f\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<p>shift = 1 # edit this value to readjust position if needed<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/897282\/\"> https:\/\/habr.com\/ru\/articles\/897282\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-455556","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=455556"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455556\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}