I have been using Sybase for years during my IT career. There are a few commands useful to measure, troubleshoot, tune your SQLs, table design in different perpectives, which are significantly helpful at work. Here are some notes.
Basic development considerations
- How often is the query run?
- How many indexes does the table have?
- Will data in the table be dynamic?
- Is the query complicated?
- How many rows will the related table contain?
- How many columns does the table have?
Useful commands in troubleshooting
- set statistics io
- set statistics time
- set showplan
- update statistics
set statistics io
- Use this command to find out the IO usage, including the cache hit ratio;
- IO us an indicative measurement of performance - estimating the work done;
- Shows the physical and logical IO used in the query;
- Includes any additional IO also from the tempdb.
Output contains
"Table" - The name of the table accessed
"scan count" - The number of times the table is accessed (index and table scan)
"logical reads" - The number of pages accessed from memory
"physical reads" - The number of physical reads
"Total writes for this command" - The number of pages written to disk
set statistics time
- Use this command to find out the SQL Server CPU usage and elapsed time;
- Use to see how much time is spent on CPU.
Output contains
"Execution Time" - Time taken to parse and compile the command
"CPU time" - Time taken to execute each step of the command
"elapsed time" - Total time taken to execute the query
set showplan on
- Use this command to find out what steps and internal settings SQL Server will use to execute the query;
- Indicate whether an index or a table scan is being used;
- Use of work tables (tempdb) is indicated;
- Table orders of joins;
- Use of indexes (full or partial).
Output
"Query plan" - Marks the beginning of each query plan
"Step n" - Sequential # for each step and each statement
"The type of query" - Type of query
"From table" - Indicate the table scan reads
"Nested iteration" - Indicate the execution of a data retrieval loop
"Table scan" - Report when the query performs table scan, or the name of the index if used
"Ascending scan" - Indicate the direction of the scan
"Position at start of table" - Indicate where the scan begins
update statistics
- Ensure run this command before start analyzing;
- Usually run in production for database maintenance.
Useful commands in gathering information
- sp_help
- sp_spaceused
- sp_helptext
sp_help
- Use this command to find out information on any object in the database;
- Detect missing indexes, inappropriate table locking schemes, datatype mismatch;
- Can be used against any objects that can be found in sysobjects table.
sp_spaceused
- Use this command to find out spacing information for an object or a database;
- Detect the volume of table in use
分享到:
相关推荐
dockerfile-best-practices-1-cn.mddockerfile-best-practices-1-cn.md dockerfile-best-practices-1-cn.md dockerfile-best-practices-1-cn.md dockerfile-best-practices-1-cn.md dockerfile-best-practices-1-...
SAP Best Practices--重复制造
apache-spark-best-practices-and-tuning apache-spark-best-practices-and-tuning
CUDA流(Streams)是NVIDIA CUDA编程模型中的一个关键概念,它允许开发者更精细地控制GPU上的任务执行和数据传输,以实现并发执行和提升应用程序性能。在CUDA编程中,流表示一系列CUDA操作的执行顺序,这些操作可以...
在这篇名为“Best-FPGA-Development-Practices-2014-02-20”的论文中,作者Charles Fulks讨论了提升FPGA(现场可编程门阵列)设计质量的方法,通过介绍实用和高效的FPGA开发最佳实践。论文从设计流程、错误预防、...
Pandas-Tips-Tricks-and-Best-Practices-main
Daniel-Roy-Greenfeld-Audrey-Roy-Greenfeld-Two-Scoops-of-Django_-Best-Practices-for-Django-1.8-Two-Scoops-Press-2015.pdf 高清无水印版
Introduction and Definitions of Software Best Practices 1 Chapter 2. Overview of 50 Software Best Practices 39 Chapter 3. A Preview of Software Development and Maintenance in 2049 177 Chapter 4. How ...
《React设计模式与最佳实践》是一本深入探讨React开发中高效、可维护代码的书籍,其原书代码提供了丰富的示例和实践案例。通过研究这些代码,开发者可以深入理解如何在React项目中应用设计模式,遵循最佳实践,提升...
这份名为《30_Auto_Layout_Best_Practices-v1.0》的文档提供了30条Auto Layout的最佳实践,旨在帮助开发者提高效率,节省设计适用于任何设备的iPhone或iPad UI的时间。 首先,文档强调了设计时应该以iPhone 8为基础...
在"Unite 2D Best Practices - Unity 2D Animation IK Camera Avator"这个主题中,我们将深入探讨如何有效地利用Unity的2D动画系统,包括Inverse Kinematics(IK)控制、摄像机适应以及角色换装等关键概念。...
标题所指的"best-practices-for-upgrading-11gr2"即为关于升级到Oracle Database 11g Release 2的最佳实践。描述中提到官方升级最佳实践,列出了在进行升级时应当遵循的一些重要做法。标签"upgrade 11g"直接指明了这...
C++ Best Practices ---------------------------------------------------- 本 PDF 基于开源文档,目录书签齐全。 版权归原作者。 ----------------------------------------------------
本篇文章将围绕"Java-EE-8-Design-Patterns-and-Best-Practices-源码.rar"中的内容,深入探讨Java EE 8中的一些关键设计模式和最佳实践。 1. **设计模式**: - **工厂模式**:用于创建对象的类,提供了一种封装...
android-database-best-practices android-database-best-practices android-database-best-practices android-database-best-practices android-database-best-practices