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 344923
In Process

The Archive Base Latest Questions

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

Since, guid values will always be unique anyway why use a unique index. Isnt

  • 0

Since, guid values will always be unique anyway why use a unique index. Isnt it true that when you use a unique index that it slows down inserts?

  • 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-12T11:02:09+00:00Added an answer on May 12, 2026 at 11:02 am

    Uses of UNIQUE constraints:

    • Enforcing uniqueness. Although a generated GUID is very likely to be unique, you could easily insert the same GUID in multiple rows. Of course you could do it by mistake, but this may even be part of your design, for instance for compound key constraints in many-to-many tables.

      CREATE TABLE BookAuthors (
        guid INT PRIMARY KEY,
        BookGuid INT NOT NULL,
        AuthorGuid INT NOT NULL,
        FOREIGN KEY (BookGuid) REFERENCES Books(BookGuid),
        FOREIGN KEY (AuthorGuid) REFERENCES Authors(AuthorGuid),
        UNIQUE KEY (BookGuid, AuthorGuid)
      );
      
    • Being the target of a foreign key. You probably are accustomed to FOREIGN KEY referencing a PRIMARY KEY of the parent table. Did you know that a FOREIGN KEY can also reference a UNIQUE KEY?

      CREATE TABLE Acknowledgements (
        guid INT PRIMARY KEY,
        BookGuid INT NOT NULL,
        AuthorGuid INT NOT NULL,
        Acknowledged VARCHAR(100) NOT NULL,
        -- this works because of the UNIQUE constraint in BookAuthors:
        FOREIGN KEY (BookGuid, AuthorGuid) 
          REFERENCES BookAuthors (BookGuid, AuthorGuid)
      );
      
    • Performance. UNIQUE is a constraint, as others have pointed out, but in most brands of database, an index is implicit when you define a UNIQUE, PRIMARY KEY, or FOREIGN KEY constraint. You’re right that there’s some overhead when inserting to any indexed table, but the performance benefit of an index is a net win, usually many times over.

    • Uniqueness notwithstanding NULL. While the primary key is crucial for the use of identifying a rows in a table, they don’t permit NULLs. You can use UNIQUE constraints to enforce uniqueness in nullable columns.

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

Sidebar

Related Questions

I have an sql server script which inserts known fixed guid values into a
I'm working with a legacy database that stores GUID values as a varchar(36) data
I making a method that generate a unique string key for some parameters. But
Imagine that you have a method with the following signature: public void DoSomething(Guid id)
Ok so we have some tables in SQL that identifies users by their Guid
Since the support for BO and Crystal pretty much stinks when it comes to
Since I installed IE8 (Win XP) Visual Studio 2008 Pro stopped deebugging javascript. When
Since version 1.5 Subversion supports to have a local caching-proxy for the main Master-repository.
since IE won't render XHTML as XHTML, but treat it as HTML instead, when
Since TCP header is a relatively large overhead, why don't we compress it in

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.