Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 935721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:12:08+00:00 2026-05-15T21:12:08+00:00

Changing and finding stuff in a database containing a few dozen tables with around

  • 0

Changing and finding stuff in a database containing a few dozen tables with around half a million rows in the big ones I’m running into timeouts quite often.

Some of these timeouts I don’t understand. For example I got this table:

CREATE TABLE dbo.[VPI_APO]
 (
  [Key] bigint IDENTITY(1,1) NOT NULL CONSTRAINT [PK_VPI_APO] PRIMARY KEY,
  [PZN] nvarchar(7) NOT NULL,
  [Key_INB] nvarchar(5) NOT NULL,
 ) ON [PRIMARY]
GO

ALTER TABLE dbo.[VPI_APO] ADD CONSTRAINT [IX_VPI_APOKey_INB] UNIQUE NONCLUSTERED 
 (
  [PZN],
  [Key_INB]
 ) ON [PRIMARY]
GO

I often get timeouts when I search an item in this table like this (during inserting high volumes of items):

SELECT [Key] FROM dbo.[VPI_APO] WHERE ([PZN] = @Search1) AND ([Key_INB] = @Search2)

These timeouts when searching on the unique constraints happen quite often. I expected unique constraints to have the same benefits as indices, was I mistaken? Do I need an index on these fields, too?
Or will I have to search differently to benefit of the constraint?

I’m using SQL Server 2008 R2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:12:09+00:00Added an answer on May 15, 2026 at 9:12 pm

    A unique constraint creates an index. Based on the query and the constraint defined you should be in a covering situation, meaning the index provides everything the query needs without a need to back to the cluster or the heap to retrieve data. I suspect that your index is not sufficiently selective or that your statistics are out of date. First try updating the statistics with sp_updatestats. If that doesn’t change the behavior, try using UPDATE STATISTICS VPI_APO WITH FULL SCAN. If neither of those work, you need to examine the selectivity of the index using DBCC SHOW_STATISTICS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After changing the import as a from-import i'm running into this error: from datetime
I'm running a program to benchmark how fast finding and iterating over all the
This type of stuff drives me nuts. I'm having trouble finding the exact issue
I'm changing Flex for HTML / CSS / Javascript but I'm finding some difficulties
I'm finding surprisingly little information on converting an existing database from Encrypted passwords to
I'm running a few fql queries to try and pull insights data into my
Changing the open_basedir directive to work with subdomains works absolutely fine on my server
changing a static resource during runtine is something that sounds not possible. I have
Changing a Linux C++ program which gives the user limited file access. Thus the
After changing - #import <Cocoa/Cocoa.h> to #import <UIKit/UIKit.h> - pi to M_PI and disabling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.