<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 24 May 2013 02:44:04 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Brian Swan's Blog: Troubleshooting and Performance Tuning with SQL Server Traces]]></title>
      <guid>http://www.phpdeveloper.org/news/15627</guid>
      <link>http://www.phpdeveloper.org/news/15627</link>
      <description><![CDATA[<p>
<i>Brian Swan</i> has posted <a href="http://blogs.msdn.com/b/brian_swan/archive/2010/12/22/troubleshooting-and-performance-tuning-with-sql-server-traces.aspx">an example of debugging with SQL Server traces</a> you can use in your PHP applications to help figure out what all's happening each time you run a query.
</p>
<blockquote>
Unfortunately, SQL Profiler (a tool that allows you to easily monitor server activity)  is not included as part of SQL Server Express. Fortunately, SQL Profiler is just a nice UI for functionality that is built into SQL Server (including the Express version). So, in this post I'll show you how to create, read from, and write to a trace file using SQL and SQL Server Management Studio (which you can download for free from <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=56ad557c-03e6-4369-9c1d-e81b33d8026b">here</a>).
</blockquote>
<p>
He breaks the process down into a few steps with sample code and SQL for each:
</p>
<ul>
<li>Create a trace (with the sp_trace_create stored procedure)
<li>Set the events to be monitored
<li>Filter trace data
<li>Start the trace
<li>Read trace data (this is where PHP comes in, code included)
</ul>
<p>
With <a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-78-metablogapi/3806.image_5F00_1D7BA312.png">the results</a> you can see things like read time, write time and CPU used for each part of the query making it simple to pick out the offenders.
</p>]]></description>
      <pubDate>Thu, 23 Dec 2010 12:02:41 -0600</pubDate>
    </item>
  </channel>
</rss>
