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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:46:54+00:00 2026-05-27T06:46:54+00:00

MAIN_TABLE has over 100 million records in it; SECURITY_TABLE has over 250 million records

  • 0

MAIN_TABLE has over 100 million records in it; SECURITY_TABLE has over 250 million records in it. I’m trying to retrieve objects from MAIN_TABLE that match the filter criteria and that the current user also has access to (access records are stored in security_table). I’m using something similar to the following to query it:

01 select col1, col2, col3 from main_table
02 where (col4 like '%something%' 
03    or col4 like '%something else%' 
04    or col4 like "%some other thing%')
05 AND
06 col1 in (select st_col1 from security_table 
07    where st_id in (
08        select col1 from main_table
09        where (col4 like '%something%' 
10        or col4 like '%something else%' 
11        or col4 like "%some other thing%'
12        )
13    )
14    AND
15    st_user_id = current_user_id
16)

If I had five matches on the filter criteria in lines 2-4 (criteria A), would the filter criteria in lines 9-11 (criteria B) rescan the entire 100 million records in MAIN_TABLE or only include the five records that were returned from lines 2-4?

  • 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-27T06:46:55+00:00Added an answer on May 27, 2026 at 6:46 am

    It Depends™ on a lot of things, including your RDBMS (SQL Server, Oracle, MySQL, etc).

    However, the answer for most of these is maybe?.

    SQL Server for instance may check the second criteria if the query analyzer determines that based on indexes and cardinality it will be quicker. They may also very likely be checked in parallel and the have the contents of both checks compared in a hash table to find the intersection.

    For your specific circumstance, the nature of the query requires a table scan so it’s irrelevant.

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

Sidebar

Related Questions

I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has
I have a table whose records represent certain objects. For the sake of simplicity
Since upgrading from 4.7 to ECC6 the ABAP compiler has become a lot stricter
I have a table that has the potential to have a lot of different
If my table has a huge number of columns (over 80) should I split
I have a system that we have recently developed - a web application over
I currently have a site with a table that has Lat/Long float columns, and
i have a database that has a list of employees of an organziation. There
I have a database in production with one table that has grown extremely large
I know that this topic has been beaten to death, but it seems that

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.