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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:19:20+00:00 2026-06-18T02:19:20+00:00

I have a search that calls a stored proc which accepts up to 5

  • 0

I have a search that calls a stored proc which accepts up to 5 parameters.
there are a number of tables in the query but the params are all filtering on a single table within the query.
question is
is it better to have an index for each of the params (fields in the table) or one index that covers all of them
there are obviously other queries that may use 1 or more of these fields for their own purposes so maybe it is worth leaving an index for each of the fields.

sorry if that is not a clear question

question: is it better to have a covering index – that covers ALL the search fields.
OR
an index for each

which is the better practice?

any help much appreciated
thanks

nat

  • 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-18T02:19:21+00:00Added an answer on June 18, 2026 at 2:19 am

    I suspect the answer depends on how the “up to” 5 parameters are most commonly specified. If they are commonly specified in a particular sequence of increasing specificity (e.g. records for a clientid, or a clientid + accountid, or clientid + accountid + month etc) then if you build the covering query in that order, then most of the <5 queries will still be able to use it efficiently.

    If, OTOH, which particular params are specified and which not is relatively random, AND you have other processes wanting indexes on some of these columns, then you may be as well to index each column separately.

    In an ideal world, of course, you would have a performance testing rig to find out the correct decision empirically. But so few projects get built in ideal worlds. Even so, you can’t beat a bit of testing, even if your DEV rig looks nothing like production.

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

Sidebar

Related Questions

I have a stored proc that does a geospatial query. The proc issues two
I have an Ext.form.Panel that calls a PHP page by passing search parameters. The
I have a search page that if there is results in the list it
I have a search function that executes a stored procedure and returns results. If
I have written a single stored procedure that returns 2 tables: select * from
I have a search method that takes in a user-entered string, splits it at
I have a search engine that searches albums. For each music album, I have
I have a search functionality that obtains data from an InnoDB table ( utf8_spanish_ci
the div on website below that have search at the bottom and it always
In my jsp application I have a search box that lets user to search

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.