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 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

Since the keyboard is the interface we use to the computer, I've always thought
Since both a Table Scan and a Clustered Index Scan essentially scan all records
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
Since CS3 doesn't have a web service component, as previous versions had, is there
Since Graduating from a very small school in 2006 with a badly shaped &
Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote
Since debate without meaningful terms is meaningless , I figured I would point at
Since Rails is not multithreaded (yet), it seems like a threaded web framework would
Since the only operations required for a container to be used in a stack
Since the release of Adobe AIR I am wondering why Java Web Start has

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.