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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:11:33+00:00 2026-05-20T20:11:33+00:00

I have a question on indexing a column and here it is I have

  • 0

I have a question on indexing a column and here it is

I have a table which have 3 columns of data type as below.

VARCHAR(255) --- Have many duplicates (say 10% unique records)
VARCHAR(64) --- Have many duplicates (say 10% unique records)
VARCHAR(MAX) --- Surely can’t choose this COL as key col for index

If I want to create a index on this table, How should I do it in this situation?

OR

Shall I create a auto increment column?

Can you please help me in this.

Thanks,
Rahul

  • 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-20T20:11:34+00:00Added an answer on May 20, 2026 at 8:11 pm

    You can create index on every column if you like, it doesn’t matter if they have unique data or not.

    Indexes are used for faster retrieving info, searching and filtering on the indexed column.

    An index can also be applied to a combination of columns (fields).

    So, you can add an index on field1, another for field2, another for field3, another for (field1, field3) combination, etc. What is best, depends on what use you plan to do the table.

    If, one the other hand, you want to create a Primary Key and not an index:

    Choosing a column for primary key:

    1. the column must uniquely identify every row (so, you can’t use field1 or field2 that have duplicates).

    2. It’s better if it is as small as possible, so when used as foreign key in other tables, it doesn’t take much space (and for other reasons as well). SO, you better not use field3 – although you can do that in a test database or a small one or if you don’t care about performance.

    So, yes, my advice would be to add another auto incremented column and use it as primary key.


    As for unique indexes:

    When creating a primary key, a unique index on the field is created as well.

    You can also (or without a primary key) create a unique index on a field (or combination of). In your case where fields 1 and 2 have duplicates, you either make a unique index on field3 or add an auto incremented field and a unique index on that.

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

Sidebar

Related Questions

I have question about database optimizing, indexing. I have table that called projects and
I have a table with 8 columns with mixed datatypes (int, text, varchar, etc..)
I have (another) question about indexing. I use the following code: CREATE TABLE [dbo].[PnrDetails1](
I have a general question about the way that database indexing works, particularly in
I have design a database. Theres no columns with indexing, nor any code for
I have a table with two columns: latitude and longitude. I want to get
Background: I have a table with 5 million address entries which I'd like to
I have a MySQL indexing question for you guys. I've got a very large
I have a question concerning best-practices for indexing in SQL Server (or any RDBMS
This is a MySQL question: I have a table with the following structure. reference

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.