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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:18:47+00:00 2026-06-17T19:18:47+00:00

UNIQUE is an index which makes your field, well, unique. But is it worth

  • 0

UNIQUE is an index which makes your field, well, unique. But is it worth using it if you’re already doing your validation in PHP prior to inserting new data? An extra INDEX isn’t the end of the world but if you’re after query optimization then UNIQUE just gets in the way, right?

  • 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-06-17T19:18:48+00:00Added an answer on June 17, 2026 at 7:18 pm

    Why wear a seat belt if you’re a good driver and you can save two seconds of your total trip time?

    One of the most important lessons for a programmer to learn is that he is human and he makes mistakes. Worse, everyone else working on this code is human, too.

    Why does the UNIQUE constraint exist? To protect the database from humans making mistakes. Turning off your UNIQUE constraint says “You do not need to worry, Mr. Database, I will never give you data that doesn’t match my intent.”

    What if something happens to your code such that your validation for uniqueness breaks? Now your code dumps duplicate records into the database. But if you had a UNIQUE constraint on that column, when your front-end code stopped working, you’d get your queries blowing up.

    You’re human. Accept it. Let the computer do its job and help protect you from yourself.

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

Sidebar

Related Questions

Most of my database tables have a clear unique index through which lookups are
I have an unique index on a text field and I was wondering if
When I try to create a unique index on a large table, I get
I've created a compound unique index on my table: CREATE TABLE [dbo].[SearchIndexWord]( [ID] [int]
Since, guid values will always be unique anyway why use a unique index. Isnt
I'd like to create a deferrable unique functional index in Oracle 10g. I know
Why does INDEX creation statement have UNIQUE argument? As I understand, the non-clustered index
I want to index PDF (and other rich) documents. I am using the DataImportHandler.
I'm familiar with the syntax of create unique index 'blah' on 'some_table' ('col1','col2') however
I have a table with unique index on two columns, id_parent and sort_order to

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.