sqlperformance

Performance Impact of Empty file by migrating the data to other files in the same filegroup

We have a database currently sitting on 15000 RPM drives that is simply a logging database and we want to move it to 10000 RPM drives. While we can easily detach the database, move the files and reattach, that would cause a minor outage that we're trying to avoid. So we're considering using DBCC ShrinkFile with EMPTYFILE. We'll create a...

SQL Server SELECT INTO and Blocking With Temp Tables

So, recently a DBA is trying to tell us that we cannot use the syntax of SELECT X, Y, Z INTO #MyTable FROM YourTable To create temporary tables in our environment, because that syntax causes a lock on TempDB for the duration of the stored procedure executing. Now, I've found a number of things that detail how temporary tables work, s...

How to measure performance of query in oracle

Hi all, I'm new to Oracle db. I have 2 queries which return the same result set. I want to measure the performance of each of them and choose the better one. How do I do that using Oracle SQL developer? I remember reading that certain tools provide stats. Any pointers on how to read these stats? Update: As suggested by Rob Van, I used ...

Database/SQL: How to store longitude/latitude data?

Performance question ... I have a database of houses that have geolocation data (longitude & latitude). What I want to do is find the best way to store the locational data in my MySQL (v5.0.24a) using InnoDB database-engine so that I can perform a lot of queries where I'm returning all the home records that are between x1 and x2 latitu...

How bad is opening and closing a SQL connection for several times? What is the exact effect?

For example, I need to fill lots of DataTables with SQLDataAdapter's Fill() method: DataAdapter1.Fill(DataTable1); DataAdapter2.Fill(DataTable2); DataAdapter3.Fill(DataTable3); DataAdapter4.Fill(DataTable4); DataAdapter5.Fill(DataTable5); .... .... Even all the dataadapter objects use the same SQLConnection, each Fill method will open...

Recommended way of SQL 2005 DB setup

Just got a win 2003 (64-bit) server box with 6 x 320 GB disks and intending to install mssql 2005 (64-bit standard). Thinking of setting up the following: Disk 1 & 2 run Raid 1, split into C:\ for OS (~50GB) and D:\ for all .ldf files (~250GB) Disk 3 to 6 run Raid 0, split into E:\ for .mdf files (~700GB) and F:\ for running backups et...

sql execution plan nested loop

trying to remove the nested loop in the execution plan of a query i have (mssql 2005). have the following table: TxnID bigint CustID bigint col1 varchar(4) col2 varchar(4) col3 varchar(4) TxnCurrency char(3) TxnAmt money TxnDate datetime -- query 1 SELECT CustID, TxnCurrency, SUM(TxnAmt) AS TxnAmt FROM table WHERE TxnDate >= @dat...

What tools are people using to measure SQL Server database performance?

I've experimented with a number of techniques for monitoring the health of our SQL Servers, ranging from using the Management Data Warehouse functionality built into SQL Server 2008, through other commercial products such as Confio Ignite 8 and also of course rolling my own solution using perfmon, performance counters and collecting of v...

Optimzing TSQL code

My job is the maintain one application which heavy use SQL server (MSSQL2005). Until now middle server stores TSQL codes in XML and send dynamic TSQL queries without using stored procs. As I am able change those XML queries I want to migrate most of my queries to stored procs. Question is folowing: Most of my queries have same Where con...

SQL running slow when i executes thru java

I am trying to execute a query in oracle db. When i try to run thru SQLTools the query is executing in 2 seconds and when i run the same query thru JAVA it is exectuting in more than a minute. I am using a hint /*+ordered use_nl (a, b)*/ I am using ojdbc6.jar Is it because of any JARS? Please help whats causing this? ...

SQL Query takes about 10 - 20 minutes

I have a select from (nothing to complex) Select * from VIEW This view has about 6000 records and about 40 columns. It comes from a Lotus Notes SQL database. So my ODBC drive is the LotusNotesSQL driver. The query takes about 30 seconds to execute. The company I worked for used EXCEL to run the query and write everything to the works...

LINQ-to-Entities get rid of sp_executesql

I am trying to optimize my database now using Database Engine Tuning Advisor, and the problem I am facing is that my SQL Profiler trace shows tons of queries performed using sp_executesql - and the advisor fails to process those. It seems like these queries come from LINQ-to-Entities I am using, so just curious if there is any way to mak...

How to store query execution plan so that they can be used later

My applications runs queries against a sql server database. In many cases I can see the benefit of an execution plan: for example I click for the first time on a button to SELECT * from Tasks WHERE IdUser = 24 AND DATE < '12/12/2010' and DATE > '01/01/2010' it takes 15 seconds the first time, 8 seconds the following times. EDIT: ...