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

  • Home
  • SEARCH
  • 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 74203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:19:17+00:00 2026-05-10T20:19:17+00:00

I’ve got a strange problem with SQL Server 2000, and I just can’t think

  • 0

I’ve got a strange problem with SQL Server 2000, and I just can’t think of a reason for this to happen.

There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:

(VARCHAR(11), INT, DATETIME)   /* can't change this, so don't suggest I should */ 

So, joining them like this is easy enough:

SELECT t1.Foo, t2.Bar FROM   table1 t1 INNER JOIN table2 t2 ON t1.VarcharKey = t2.VarcharKey WHERE  t1.VarcharKey = 'Foo' 

Looking at the query execution plan, I see this:

  • Clustered Index Seek [db].[dbo].[table1].[PK_table1] (48%)
  • Clustered Index Seek [db].[dbo].[table2].[PK_table2] (51%)
  • Nested Loops (Inner Join) (1%) Warning: NO JOIN PREDICATE
  • Select (0%)

Now if I do this (note the NVARCHAR string!):

SELECT t1.Foo, t2.Bar FROM   table1 t1 INNER JOIN table2 t2 ON t1.VarcharKey = t2.VarcharKey WHERE  t1.VarcharKey = N'Foo' 

I get:

  • Clustered Index Scan [db].[dbo].[table1].[PK_table1] (98%)
  • Clustered Index Seek [db].[dbo].[table2].[PK_table2] (1%)
  • Nested Loops (Inner Join) (1%) no warning here
  • Select (0%)

This behavior leaves me a bit puzzled.

  • Why is there a ‘NO JOIN PREDICATE’ warning, and why does it go away when I change 'Foo' to N'Foo'? My key columns are not of type NVARCHAR, so this should not make any difference, or should it?
  • Does the presence of this warning have negative implications or can I ignore it?
  • Why does it switch from an Index Seek to an Index Scan?

Some background info: Table cardinality is ca. 25,000 records one table, ca. 12,000 records in the other. Database compatibility level is 80 (SQL Server 2000) default collation is SQL_Latin1_General_CP1_CI_AS, if that makes any difference at all.

Here’s the contents of @@VERSION:

Microsoft SQL Server 2000 – 8.00.2273 (Intel X86) Mar 7 2008 22:19:58 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)

P.S.: I am aware of KB322854, but this is not it, obviously.

  • 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. 2026-05-10T20:19:17+00:00Added an answer on May 10, 2026 at 8:19 pm

    Why does it switch from an Index Seek to an Index Scan?

    This is largely a guess, but here goes:

    In the first case (‘Foo’), MSSQL recognize that the value being search for is a perfect match for the first part of the index on t1, and therefore uses the index to find a record in t1 (Index Seek, possibly a binary search). Having found a record in t1 which has an index which perfectly matches t2, it can use the index to find records in t2.

    In the second case, (N’Foo’), MSSQL recognizes that it does NOT have a perfect match between the index and the value being seeked, so it cannot use the index as an index, but must do a full table scan. However, since the index holds the information needed (in a different form) and is smaller than the full table, it can do a full scan of the index as if it were the table (This is faster than scanning the table, since fewer pages need to be read for the disk; mevertheless, it seems to be taking about 90X longer than the index seek)

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

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Rex, first a few questions: Is this a WinForms/WPF app… May 11, 2026 at 11:53 am
  • added an answer In the spirit of DRY, I would say this is… May 11, 2026 at 11:52 am
  • added an answer Games.find( :all, :limit => 5, :include => [:games, :requests], :group… May 11, 2026 at 11:52 am

Related Questions

I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
I have a web-service that I will be deploying to dev, staging and production.
I'm thinking of starting a wiki, probably on a low cost LAMP hosting account.
I have the following tables in my database that have a many-to-many relationship, which
I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having
I recently printed out Jeff Atwood's Understanding The Hardware blog post and plan on
I find that getting Unicode support in my cross-platform apps a real pain in
I would like to test a string containing a path to a file for
I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.