1. Click on the Office Button
2. Choose Manage then Compact and Repair Database
3. on the task bar you can see the progress bar showing that the database is compacting:
SQL Server, SSIS, powershell
1. Click on the Office Button
2. Choose Manage then Compact and Repair Database
3. on the task bar you can see the progress bar showing that the database is compacting:
I read a lot of pdf files. One thing I always found rather annoying is that the pdf files open at very high zoom percentage , something like 263% so I have to adjust the zoom for every document.
Fixing this is easy, Go to Edit | Preferences :
Then Go to Page Display | Default Layout and Zoom :
Choose the desired value. That’s it , the next time you’ll open pdf documents, the zoom will be 100%.
For those who may be starting out with query execution plans, it may be interesting to consider the use of Search arguments (SARG) in queries. The use of SARG has 2 objectives :
- Limit the number of rows returned by the query
- Use an index seek operation to improve the performance of the query
If the filter is not a SARG then typically an index scan or table scan is performed on the entire table or index.
2 points to remember :
- A filter expression is not a SARG if the column is used in an expression such as YEAR(OrderDate) or LEFT(Employee.Name,1)=’B’
- The use of the COLLATE operator on a column invalidates the use of and index on that column.
A simple Example using AdventureWorks2008:
CREATE NONCLUSTERED INDEX OrderDateIndex ON Sales.SalesOrderHeader ( Orderdate )
GO
SELECT COUNT(*) FROM Sales.SalesOrderHeader soh
WHERE YEAR(soh.OrderDate )
=2004SELECT COUNT(*) FROM Sales.SalesOrderHeader soh
WHERE soh.OrderDate >= '20040101' AND soh.OrderDate < '20050101'These 2 queries will generate the following Query plans:
The first query uses and index scan with the following cost :
as you can see the second query plan cost is reduced by using a SARG in the query resulting in the use of the index seek operator, that allows SQL server to use a balanced tree to search the records.
When tuning queries, one the first basic strategies is to minimize the use of joins. Additionally outer joins incur more cost than inner joins as they require extra work to retrieve unmatched rows.
TIP : If only inner joins are used , the ON and WHERE Clause behave the same. Consider the following queries:
you can see that the execution plans generated for both queries are the same:
If the queries would have been written with outer join, they would have different query plans.
SELECT [cp].[refcounts]
, [cp].[usecounts]
, [cp].[objtype]
, [st].[dbid]
, [st].[objectid]
, [st].[text]
, [qp].[query_plan]
FROM sys.dm_exec_cached_plans cp
CROSS APPLY sys.dm_exec_sql_text ( cp.plan_handle ) st
CROSS APPLY sys.dm_exec_query_plan ( cp.plan_handle ) qp ;
These files let you define synonyms for full text queries. There is one file for every language supported by fulltext search. To list them run the following Query:
1. List Full-text languages and their LCIDs:
SELECT * FROM sys.fulltext_languages ORDER BY lcid
2. Thesaurus File location : $SQL_Server_Install_Path\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\FTData.
3. Basic File Structure
in SQL server 2008 , you need to run sys.sp_fulltext_load_thesaurus_file as shown below :
EXEC sys.sp_fulltext_load_thesaurus_file 1033 (see above in this to find the LCID for the language).