Analyze database performance using the Database tool
Use the Database tool to record the database queries that your app makes during a diagnostic session. You can then analyze information about individual queries to find places to improve your app's performance.
Note
The Database tool requires Visual Studio 2019 version 16.3 or later and a .NET Core project using either ADO.NET or Entity Framework Core.
Setup
Select Alt+F2 to open the performance profiler in Visual Studio.
Select the Database check box.
Note
If the tool isn't available for selection, clear every other tool's check box because some tools need to run alone. To learn more about running tools together, see Using profiling tools from the command line.
If the tool still isn't available, check that your project meets the preceding requirements. Make sure your project is in Release mode to capture the most accurate data.
Select the Start button to run the tool.
After the tool starts running, go through the scenario you want to profile in your app. Then select Stop collection or close your app to see your data.
After collection stops, you see a table of the queries that ran during your profiling session.
The queries are organized chronologically, but you can sort them by any of the columns. You can show more columns by right-clicking the column titles. Selecting the Duration column orders the queries from the longest lasting to the shortest.
After you find a query you want to investigate, right-click the query. Then select Go To Source File to see what code is responsible for that query.
If you select a time range on a graph, the query table shows only queries that occurred during that time range. This behavior is especially useful when you also run the CPU Usage tool.
Related content
الملاحظات
https://aka.ms/ContentUserFeedback.
قريبًا: خلال عام 2024، سنتخلص تدريجيًا من GitHub Issues بوصفها آلية إرسال ملاحظات للمحتوى ونستبدلها بنظام ملاحظات جديد. لمزيد من المعلومات، راجعإرسال الملاحظات وعرضها المتعلقة بـ