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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:48:45+00:00 2026-06-15T00:48:45+00:00

Col 1, col 2, ….. ….. from table1, table2 …….. …….. where join conditions1

  • 0
Col 1,
col 2,
.....
.....
from 
table1,
table2
........
........
where
join conditions1
join conditions1
................
.................
and
table1.day_key >= (select key from date_dim where value='01-JAN-2011')
and table1.day_key <= (select key from date_dim where value='31-DEC-2011')
and 
table2.day_key >= (select key from date_dim where value='01-JAN-2011')
and table2.day_key <= (select key from date_dim where value='31-DEC-2011')

Here I can see date_dim table is doing scan four in where condition, how to avoid it. date_dim table is not selected in main from clause. I dont have enviornment to test this unfortunatly. Database is oracle 10g

  • 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-15T00:48:46+00:00Added an answer on June 15, 2026 at 12:48 am

    As I said I don’t see a performance problem scanning that table double times as necessary.

    A pure rewrite of query would be:

    select 
      Col 1,
      col 2,
    from 
      table1,
      table2,
      date_dim date_dim_start,
      date_dim date_dim_end
    where
      join conditions1
      join conditions1 and
      table1.day_key >=  date_dim_start.key and
      table1.day_key <= date_dim_end.key and
      table2.day_key >= date_dim_start.key and
      table2.day_key <= date_dim_end.key and
      date_dim_start.value = '01-JAN-2011' and
      date_dim_end.value='31-DEC-2011';
    

    But you should test it, in order to not suffer a performance hit.

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

Sidebar

Related Questions

Update Table1 set name = (select top 1 a.col from Table2 a where Table1.num
For this query: $sql='select col from table where other_col=?'; I am currently getting the
SELECT * FROM table WHERE col IN (1,2,3) or SELECT * FROM table WHERE
I have tried the following two statements: SELECT col FROM db.tbl WHERE col (LIKE
I'm using the following code: SELECT * FROM table WHERE Col IN (123,123,222,....) However,
when I have a query result for something like: select col as newName from
So, SELECT * FROM table WHERE col LIKE '%' will return everything. Is there
SELECT IFNULL(Col,'b') FROM Table Checks Col and returns Col if is not null if
I have a table TABLE1 with column COL_TAB1 . select * from TABLE1: COL_TAB1
INSERT INTO table_a (col_tinyint, col_varchar) SELECT 0, distinct(col_other_varchar) COLLATE utf8_bin FROM table_b I want

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.