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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:37:17+00:00 2026-05-13T12:37:17+00:00

We have two tables like so: Event id type … a bunch of other

  • 0

We have two tables like so:

Event
    id
    type
    ... a bunch of other columns

ProcessedEvent
    event_id
    process

There are indexes defined for

  • Event(id) (PK)
  • ProcessedEvent (event_id, process)

The first represents events in an application.

The second represents the fact that a certain event got processes by a certain process. There are many processes that need to process a certain event, so there are multiple entries in the second table for each entry in the first.

In order to find all the events that need processing we execute the following query:

select * // of course we do name the columns in the production code
from Event
where type in ( 'typeA', 'typeB', 'typeC')
and id not in (
    select event_id
    from ProcessedEvent
    where process = :1  
)

Statistics are up to date

Since most events are processed, I think the best execution plan should look something like this

  • full index scan on the ProcessedEvent Index
  • full index scan on the Event Index
  • anti join between the two
  • table access with the rest
  • filter

Instead Oracle does the following

  • full index scan on the ProcessedEvent Index
  • full table scan on the Event table
  • filter the Event table
  • anti join between the two sets

With an index hint I get Oracle to do the following:

  • full index scan on the ProcessedEvent Index
  • full index scan on the Event Index
  • table acces on the Event table
  • filter the Event table
  • anti join between the two sets

which is really stupid IMHO.

So my question is: what might be the reason for oracle to insist on the early table access?


Addition:
The performance is bad. We are fixing the performance problem by selecting just the Event.IDs and then fetching the needed rows ‘manually’. But of course that is just a work around.

  • 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-13T12:37:18+00:00Added an answer on May 13, 2026 at 12:37 pm

    your FULL INDEX SCAN will probably be faster than a FULL TABLE SCAN since the index is likely “thinner” than the table. Still, the FULL INDEX SCAN is a complete segment reading and it will be about the same cost as the FULL TABLE SCAN.

    However, you’re also adding a TABLE ACCESS BY ROWID step. It is an expensive step: one logical IO per row for the ROWID access whereas you get one logical IO per multi blocks (depending upon your db_file_multiblock_read_count parameter) for the FULL TABLE SCAN.

    In conclusion, the optimizer computes that:

    cost(FULL TABLE SCAN) < cost(FULL INDEX SCAN) + cost(TABLE ACCESS BY ROWID)
    

    Update: The FULL TABLE SCAN also enables the filter on type sooner than in the FULL INDEX SCAN path (since the INDEX doesn’t know what type an event is), therefore reducing the size of the set that will be anti-joined (yet another advantage of the FULL TABLE SCAN).

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

Sidebar

Related Questions

I have two tables like so; id_image foo bar 1 3 5 2 8
I have two tables like, CREATE TABLE [dbo].[entry] ( [id] [int] NULL, [service] [int]
I have two tables like the ones below. I need to find what exchangeRate
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
So I have two tables structured like so: CREATE TABLE #nodes(node int NOT NULL);
I'm using SQL Server 2008. Let's say I have two hypothetical tables like below:
I have two MySQL tables something like this: tool_owners: tool_owners_id | user_id | ...
Let's say I have two tables that look like this: TH TH TH TH
I have two tables which looks something like this Table Queue int ID; string
I have two tables in my database that look like that: Customer: C_ID city

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.