Вы находитесь на странице: 1из 4

What are the steps to take to improve performance of a poor performing query?

Steps to take to improve performance of queries:


Use indexes efficiently
Create all primary and foreign keys and relationships among tables.
Avoid using cursors
Avoid using Select*, rather mention the needed columns and narrow the resultset as
needed.
Denormalize
Use partitioned views
Use temporary tables and table variables
Reduce joins and heavy clauses like GROUP BY if not needed
Implement queries as stored procedures.
Have a WHERE Clause in all SELECT queries.
Use data types wisely
Instead of NULLS use string values such as N/A
Explain the different types of BACKUPs available in SQL Server.
Types of backups available in SQL Server:
Complete: This creates a complete stand alone image of the database. This backup is self
dependent and can be restored to either the same or a new database on same or other server.
Differential: This backs up only the modified contents since the last backup. They do not provide
much flexibility.
Transaction log: This backs up all transaction logs since the previous transaction log backup or
the complete transaction log backup if there has not been one in past.
Files and Filegroups backup: This option is suitable when time constraints are high and one
cannot afford to perform a complete database backup. It also needs transaction logs backup to
take place to make it worth choosing this option. After restoring file backup, apply transaction
logs to roll the file contents forward to make it consistent with the database..
3. What third party database tools are your favorites?
If somebodys been doing database administration long enough to claim the title Senior DBA,
theyve built up a little wish list of database management tools theyve seen along the way. Tool
types might include:
Data modeling
Change management
Backup compression
Performance monitoring
Alerting
If they had a $X tool budget for their workstation, how would they spend it? Forget corporate
standards I want to know what tools theyd use if they could pick on their own. Im not asking
what software theyve had experience using, because they might work somewhere so cheap that
theyre restricted to native tools only. They have to have at least seen some ads for products that
looked cool, though.
I might follow up with questions about tools we were using in-house already by saying things
like, Were currently using Product X for monitoring. Have you seen it? Whatd you think of
it?
This does two things: it gives me an outside opinion about other tools out there that my DBAs
could be using to do a better job, and it tells me how much the job candidate has seen.
How do you identify and correct a SQL Server performance issue?
o Identification - Use native tools like Profiler, Perfmon, system stored procedures,
dynamic management views, custom stored procedures or third party tools
o Analysis - Analyze the data to determine the core problems
o Testing - Test the various options to ensure they perform better and do not cause
worse performance in other portions of the application
o Knowledge sharing - Share your experience with the team to ensure they
understand the problem and solution, so the issue does not occur again
o Additional information - MSSQLTips.com Category: Performance Tuning and
Query Optimization
How do you re-architect a process?
o Review the current process to understand what is occurring
o Backup the current code for rollback purposes
o Determine what the business and technical problems are with the process
o Document the requirements for the new process
o Research options to address the overall business and technology needs
For example, these could include:
Views
Synonyms
Service Broker
SSIS
Migrate to a new platform
Upgrade in place
o Design and develop a new solution
o Conduct testing (functional, load, regression, unit, etc.)
o Run the systems in parallel
o Sunset the existing system
o Promote the new system
o Additional information - Checklist to Re-Architect a SQL Server Database
What types of replication are supported in SQL Server?
SQL Server has three types of replication: Snapshot, Merge, and Transaction. Snapshot
replication creates a snapshot of the data (point-in-time picture of the data) to deliver to the
subscribers. This is a good type to use when the data changes infrequently, there is a small
amount of data to replicate, or large changes occur over a small period of time.
Merge replication uses a snapshot to seed the replication. Changes on both sides of the
publication are tracked so the subscriber can synchronize with the publisher when connected. A
typical use for this type of replication is in a client and server scenario. A server would act as a
central repository and multiple clients would independently update their copies of the data until
connected. At which time, they would all send up their modifications to the central store.
Transaction replication also begins with a snapshot only this time changes are tracked as
transactions (as the name implies). Changes are replicated from publisher to subscriber the same
as they occurred on the publisher, in the same order as they occurred, and in near real time. This
type of replication is useful when the subscriber needs to know every change that occurred to the
data (not point-in-time), when the change volume is high, and when the subscriber needs near
real-time access to the changes.
What happens on checkpoint?
Checkpoints, whether scheduled or manually executed, cause the transaction log to be truncated
up to the beginning of the oldest open transaction (the active portion of the log). That is, the dirty
pages from the buffer cache are written to disk. Storing committed transactions in the cache
provides a performance gain for SQL Server. However, you do not want the transaction log to
get too big because it might consume too many resources and, should your database fail, take too
long to process to recover the database.
One important thing to note here is that SQL Server can only truncate up to the oldest open
transaction. Therefore, if you are not seeing the expected relief from a checkpoint, it could very
well be that someone forgot to commit or rollback their transaction. It is very important to
finalize all transactions as soon as possible.
What purpose does the model database serve?
The model database, as its name implies, serves as the model (or template) for all databases
created on the same instance. If the model database is modified, all subsequent databases created
on that instance will pick up those changes, but earlier created databases will not. Note that
TEMPDB is also created from model every time SQL Server starts up.
How do you trace the traffic hitting a SQL Server?
SQL profiler is the SQL Server utility you can use to trace the traffic on the SQL Server
instance. Traces can be filtered to narrow down the transactions that are captured and reducing
the overhead incurred for the trace. The trace files can be searched, saved off, and even replayed
to facilitate troubleshooting.
Why would you use SQL Agent?
SQL Agent is the job scheduling mechanism in SQL Server. Jobs can be scheduled to run at a set
time or when a specific event occurs. Jobs can also be executed on demand. SQL Agent is most
often used to schedule administrative jobs such as backups
Which TCP/IP port does SQL Server run on?
SQL Server runs on port 1433 but we can also change it for better security.
What is the basic difference between clustered and a non-clustered index?
- The difference is that, Clustered index is unique for any given table and we can have only one clustered
index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of
clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in
rows so we can have as many non-clustered indexes as we can on the db.

Вам также может понравиться