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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:27:35+00:00 2026-06-03T04:27:35+00:00

Lets assume a table like this [KEY] [int] NOT NULL, [INT1] [int] NULL, [INT2]

  • 0

Lets assume a table like this

[KEY] [int] NOT NULL,
[INT1] [int] NULL,
[INT2] [int] NULL,
[INT3] [int] NULL,
[STR1] [varchar](20) NULL,
[STR2] [varchar](20) NULL,
[STR3] [varchar](20) NULL,

The query is very flexed but always like this format:
SELECT KEY FROM [TABLE] WHERE...

The search condition few times on single column, and most time on several columns, for [int] type, quesy as BETWEEN or >= or <=, for varchar, always query as = or IN []. All conditions connect with AND

Since the query is not always fixed on same column(s), so I wonder, if I create INDEX on every single column, will it increase performance, or just waste at all.

  • 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-03T04:27:37+00:00Added an answer on June 3, 2026 at 4:27 am

    Don’t just create an index on every single column – that’s a total waste of time and resources!

    Basically, my approach is always:

    1. define a good primary and clustering key on any “normal” table (except for e.g. staging tables etc.) – that’s a big step already

    2. put non-clustered indices on any foreign key columns – those really help a lot, especially with JOIN’s

    And that’s it!

    Then:

    • observe your system – see when things are slow
    • measure system performance
    • capture a server-side trace to get a representative workload
    • analyse that workload, and see what additional indices might be helpful
    • do tweaks – one at a time
    • measure again and again to see if you’ve improved system performance (or not)

    You need a full, representative workload to see what queries are really common and used a lot – and see what indices might be beneficial for those frequent queries. Otherwise, you might be providing index help for all the wrong queries, and you might actually slow things down …

    You’d be surprised just how rarely non-clustered indices will really help!

    Don’t over-index – it’s just as bad – if not worse – than having no indices at all ! It might be worse, because every index that you have will also need to be maintained over its lifetime… and there ain’t no free lunch – not even here…

    See Kimberly Tripp’s excellent blog post Indexes: just because you can doesn’t mean you should! on the topic – very helpful, lots of insights. Or basically, just read anything Kim has blogged on indexes – she’s the Queen of Indexing and anything she’s posted on her blog is usually extremely helpful and beneficial!

    Furthermore, SQL Server 2005 and newer offer DMV’s (Dynamic Management Views) that allow you to find out what indices are not being used (those can be removed) or which are missing, according to SQL Server’s query optimizer’s opinion. See SQL Server – Find missing and unused indexes for more details. But be aware: those are dynamic views – they’re reset with each system start and might not be totally accurate – don’t just do everything they tell you – take everything with a grain of salt and consider carefully what you do – document it, so that you can undo it, if things get worse rather than better!

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

Sidebar

Related Questions

Lets say i have a table like this: col1 col2 col3 row1 1 null
For the sake of clarity, lets assume I have a table structure like this:
Lets assume we have a table with a fulltext field on it. This field
Lets assume I get an HTML table as a string, and I want -
I have a city table that has two columns from_city to_city now lets assume
Suppose a tree structure is implemented in SQL like this: CREATE TABLE nodes (
I have a table that looks something like this: CREATE TABLE student_results(id integer, name
Let's assume there is a SQL Server 2008 table like below, that holds 10
Lets assume the following code within a controller: $this->view->addScriptPath('dir1/views/scripts'); $this->view->addScriptPath('dir2/views/scripts'); $this->render('index.phtml'); Where dir1/views/scripts contains
This is a more theoretical question, not a specific scenario: Let's assume, we have

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.