473,626 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Non-clustered, Non-unique index performance

1 New Member
I have to regularly import records into a table in the database that also contains records that were created internally. Those that are imported have an ImportRecordID column that I use to ensure that I don't import a record twice. In the import code, I query the table on the ImportRecordID column, and if I get no results, I go ahead and add the new record. Very straightforward .

The problem is that I noticed that when I removed this "existing record" check (SELECT query), the import sped up by nearly 10x. Why should a simple SELECT take longer than 3 or 4 INSERTs? I asked myself.

So I added an Index on the ImportRecordID. It had to be non-Unique because there are many records in the table for which this value is NULL. I looked at the execution plan in Management Studio both before and after adding the index, and it assured me that I would get massive performance gains. Great!

Except that I didn't get massive performance gains when I actually ran the import. The performance on that SELECT was exactly the same. Why? How can I tell that the new Index is actually working?
Mar 26 '08 #1
0 1326

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5214
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and includes the following columns: DocID (INTEGER, PRIMARY KEY, CLUSTERED) IsRecord (INTEGER, NONCLUSTERED)
2
5349
by: Mansoor Azam | last post by:
I have the following table with indexes CREATE TABLE dbo.Scratch ( ItemID int IDENTITY (1, 1) NOT NULL , Login varchar (12) NOT NULL , StartDate datetime NULL , PayDate datetime NULL , LastDisconnect datetime NULL
4
1537
by: DC | last post by:
When a nonunique nonclustered index is built on top of a clustered index, is it guaranteed that the bookmark in the nonclustered index will be kept in the same order as the clustered index? Here's an example to demonstrate my question: CREATE TABLE indextest (col1 int NOT NULL,col2 int NOT NULL,col3 int,col4 int) ALTER TABLE indextest ADD PRIMARY KEY CLUSTERED (col1,col2) CREATE INDEX ix_indextest ON indextest (col1,col3)
5
1613
by: hishamfangs | last post by:
Hi guys! I'm facing a problem and I can't quite figure it out! I have created a table on SQL Server 2000 to store call records. We get about 250,000 calls a day, and the most frequently used query retrieves all the calls records for the day and groups them by destination, so the query would return something like this: Destination Calls Minutes
0
1248
by: Mortisus | last post by:
Hi, I'm running a fulltext query on a ~50000 record mysql database and while performance is usually satisfying - about 0.02 secs per query, i get a critical performance deterioration when looking for popular keywords (words that appear in more than 50% of the data) - about 0.25 secs/query. I know that the standard fulltext engine does not return any results on such words, and this is good, but this does not explain the performance issue....
5
2908
by: Mike Mascari | last post by:
Let's assume I have a table like so: CREATE TABLE employees ( employeeid text not null, name text not null ); CREATE INDEX i_employees ON employees(lower(name)); Let's also assume that the lower() function is computationally
7
1615
by: Raj | last post by:
Hi, I have a pretty simple query like select t1.c1,t1.c2,t1.c2, t2.c1,t2.c2 from t1, t2 where t1.c1 = ' xxx '
0
1699
by: lynn.j.gasch | last post by:
We are using a DataTable as a data source for a 3rd party grid view. We are not using the internal sorting features and I would like to find a way to turn off the indexing in the data table. We have a field value that changes frequently, and profiling shows that something like 35k changes cause nearly 3 million calls into maintaining the index, and from there about 11 million calls into the view. I have disabled sorting in the view, but...
10
1608
by: Jerry Winston | last post by:
Hello I've been tasked with supporting a newly implemented piece of off-the-shelf software that requires SQL 2000. A recent upgrade to the software radically changed the distributed design of the underlying database to a very, very index-heavy and centralized model (they dropped 80% of the PK's and added 1,000's of indexes). I've been casually keeping an eye on the performance stats coming from the server and wasn't concerned until I...
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.