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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:55:45+00:00 2026-05-12T08:55:45+00:00

I have a query which is crossing two tables select count(*) from ingenium.empevt, ingenium.evt

  • 0

I have a query which is crossing two tables

select count(*) from ingenium.empevt, ingenium.evt where empevt_evtfk = evt_pk

it takes quite a long time to run and in trying to figure out why I looked at the plan

    Operation   Object Name Rows    Bytes   Cost    Object Node In/Out  PStart  PStop

SELECT STATEMENT Optimizer Mode=CHOOSE      634 K       75981                                
  HASH JOIN     634 K   180 M   75981                                
    HASH JOIN       845 K   234 M   8930                                 
      HASH JOIN     465 K   53 M    3118                                 
        NESTED LOOPS        620 K   15 M    1618                                 
          NESTED LOOPS      1   20      2                                
            TABLE ACCESS BY INDEX ROWID INGENIUM.USR    1   10      1                                
              INDEX UNIQUE SCAN INGENIUM.XAK1USR    1                                        
            TABLE ACCESS BY INDEX ROWID INGENIUM.USR    1   10      1                                
              INDEX UNIQUE SCAN INGENIUM.XAK1USR    1                                        
          INDEX RANGE SCAN  INGENIUM.SECUSREMP_USREMP   89 M    600 M   1616                                 
        TABLE ACCESS FULL   INGENIUM.TBLEMP 620 K   55 M    1150                                 
      TABLE ACCESS FULL INGENIUM.TBLEMPEVT  1 M 182 M   4000                                 
    TABLE ACCESS FULL   INGENIUM.SECUSREMP  89 M    600 M   27013 

What I don’t like is the table access full on INGENIUM.SECUSREMP_USREMP which has a huge number of rows. I don’t know why it is scanning that table since it wasn’t in the query. INGENIUM.SECUSREMP_USREMP has a foreign key which references into ingenium.emp.emp_pk, however I don’t see why that would matter.

Is there some way to rewrite this query such that it doesn’t scan a seemingly unrelated table? Why is it scanning that table in the first place?

  • 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-12T08:55:45+00:00Added an answer on May 12, 2026 at 8:55 am

    Presumably both empevt and evt are views, not tables? Your query plan shows (only) these tables being accessed:

    • USR
    • TBLEMP
    • TBLEMPEVT
    • SECUSREMP

    What are the definitions of these views? Unless of course you are looking at the wrong plan!

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

Sidebar

Related Questions

I have this query which involves a table from another server: select count(serialno), max(convert(varchar(10),Crtd_DateTime,101))
I have a QUERY which is like SELECT COUNT(*) as cnt FROM tbl_docatrtypegroupdoctype, tbl_doctype,
I have a query which looks like: select count(*) from m1 WHERE (m1.`resource` &
I have a query which goes like this :- SELECT count(*) as count FROM
I have a query which works, goes like this: Select count(InsuranceOrderLine.AntallPotensiale) as potensiale, COUNT(InsuranceOrderLine.AntallSolgt)
I have this query (which I removed some keys from for brevity's sake): SELECT
i have a query which i want to simplify: select sequence, 1 added from
I have this query which returns all rows from a table: select Cost, Name,
I have SQL query which goes to result table: $php_variable_answer = SELECT answer_id FROM
I have a query which returns 20 rows. select year( ArticleDate ) from NewsData

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.