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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:05:16+00:00 2026-05-26T20:05:16+00:00

we have a table with 2 million records with PK userid and not unique

  • 0

we have a table with 2 million records with PK userid and not unique field “Company” we have 35,000 select query an hour to check if a userid exists in our db and what companies he is related to.

should we run the high amount of query on the main table or should we create a view with only userID and company fields and run the query against it?

what are the upside and downside?

i will appreciate your help!

P.s
the 35,000 queries an hour are with random userid, and change every time.
the user id and company are not updated but we add about 20,000 new rows a day.
my major concern is minimize the response time of the selects even if i do updates to other fields of the table.

  • 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-26T20:05:17+00:00Added an answer on May 26, 2026 at 8:05 pm

    Creating a VIEW will not help. It will simply reference the underlying table every time you use it.

    What might help is to create a covering index on the columns you query. Assuming you only need UserID and Company:

     CREATE INDEX <Name> ON <Table> (UserID, Company)
    

    Now, queries of the form

    SELECT Company FROM <Table> WHERE UserID = <Value>
    

    can be satisfied from the index without reference to the table data. This will probably improve your performance (on SELECTs).

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

Sidebar

Related Questions

I have a table now containing over 43 million records. To execute SELECT ,
I have a table with 6 million + records, but the first field has
I have a table with 5 million records of dates stored as char(10) with
I have a table with 42 million records. 32 million have a null value
I have a table that has 8 million records, with many fields, including lat/long
I have a table that has about 1/2 million records in it. Each month
I have a large table with 1 million+ records. Unfortunately, the person who created
I have a very large database with about 120 Million records in one table.I
I have a huge data table (200+ million records) which stores cash amounts for
I have a table TDATAMAP which has around 10 million records, I want 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.