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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:12+00:00 2026-05-26T16:26:12+00:00

I am trying to do a report off three tables where data gets loaded

  • 0

I am trying to do a report off three tables where data gets loaded on the daily basis. Catch is that data is “dirty” (see WHERE clause). Even though I have an index on each of the three tables for the column I do my equijoin against , the query never returns.

SELECT 
A.SITE || ',' ||
A.SCRIPT || ',' ||
A.TESTRESULT || ',' ||
A.BISTERROR || ',' ||
A.HDDMANUFACTURER || ',' ||
A.TESTDATE || ',' ||
A.STB_MODEL || ',' ||
A.RECEIVERID || ',' ||
B.STB_MODEL || ',' ||
B.STB_MANUFACTURER || ',' ||
B.STB_MFRDATE || ',' ||
B.SW_VERSION || ',' ||
B.SW_NAME || ',' ||
B.HW_VERSION || ',' ||
B.RECEIVERID || ',' ||
C.HDDMODELNUMBER || ',' ||
C.HDDSERIALNUMBER || ',' ||
C.DISKPORT || ',' ||
C.DISKSIZE || ',' ||
C.SECTORSIZE || ',' ||
C.POWERONHOURS || ',' ||
C.CURRENTTEMP || ',' ||
MAX(TRUNC(A.LOAD_DATE)) 
FROM 
HDD_SMARTLOG_FILEINFO A, 
HDD_SMARTLOG_BOXINFO B, 
HDD_SMARTLOG_DISKINFO C 
WHERE 
A.FILENAME=B.FILENAME 
AND 
B.FILENAME=C.FILENAME 
AND 
INSTR(TRANSLATE(A.RECEIVERID,'0123456789','XXXXXXXXXX'),'X') != LENGTH(A.RECEIVERID) 
AND 
INSTR(TRANSLATE(B.RECEIVERID,'0123456789','XXXXXXXXXX'),'X') != LENGTH(B.RECEIVERID) 
AND 
LOWER(C.DISKPORT)='internal' 
AND 
A.SITE IS NOT NULL OR A.SITE <> '' 
AND 
A.BISTERROR IS NOT NULL OR A.BISTERROR <> '' 
AND 
B.STB_MODEL IS NOT NULL OR B.STB_MODEL <> '' 
AND 
B.SW_VERSION IS NOT NULL OR B.SW_VERSION <> '' 
AND 
C.POWERONHOURS IS NOT NULL OR C.POWERONHOURS <> '' 
AND 
C.CURRENTTEMP IS NOT NULL OR C.CURRENTTEMP <> '' 
AND 
INSTR(TRANSLATE(C.POWERONHOURS,'0123456789','XXXXXXXXXX'),'X') != LENGTH(C.POWERONHOURS) 
AND 
INSTR(TRANSLATE(C.CURRENTTEMP,'0123456789','XXXXXXXXXX'),'X') != LENGTH(C.CURRENTTEMP) 
GROUP BY 
A.SITE, 
A.SCRIPT, 
A.TESTRESULT, 
A.BISTERROR, 
A.HDDMANUFACTURER, 
A.TESTDATE, 
A.STB_MODEL, 
A.RECEIVERID, 
B.STB_MODEL, 
B.STB_MANUFACTURER, 
B.STB_MFRDATE, 
B.SW_VERSION, 
B.SW_NAME, 
B.HW_VERSION, 
B.RECEIVERID, 
C.HDDMODELNUMBER, 
C.HDDSERIALNUMBER, 
C.DISKPORT, 
C.DISKSIZE, 
C.SECTORSIZE, 
C.POWERONHOURS, 
C.CURRENTTEMP;

It used to work about a month ago when we had less than 100K records on a daily basis. Now, we are processing +/- 300K daily.

How can I optimize this query. My boss wants it to be run daily. Can you please provide a few pointers?

Thanks in advance!

  • 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-26T16:26:12+00:00Added an answer on May 26, 2026 at 4:26 pm

    Do all of these:

    1. Create indexes for the fields which are part of your where.

    2. Instead of using Descartes multiplication (which you are currently using) use joins.

    3. In your where clause put the quicker and less probable logical operands first. For instance where A and B is true if both of them are true, so if A is false, B won’t be calculated at all and you win a lot of time. This might be a difference of doing hundreds of thousands of logical checking or not doing it, so, of course this is an optimisation.

    I’m not rewriting your query, because I can’t tell which operands are less probable, which operands are quicker, you will have to measure each operand and order them in such a way that the less probable or quicker operands are calculated first and hoping that the others won’t get calculated.

    I hope this helps.

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

Sidebar

Related Questions

I'm trying to build a simple RDLC report that shows some data, and has
I'm working on trying to generate a report from a couple of database tables.
I am trying to create a report in SSRS2000 that will query an ORACLE
I'm trying to produce a report that has multiple grouping but does not just
I am trying to print a report that contains a bar graph using the
i am trying to create a report from a row of data with about
I'm trying to get a report built up from data mining our accounting software.
I'm trying to pull the links off of a bunch of webpages and report
I would like to build a very basic daily sales report. I'm am trying
I am trying to put together a query that gives me a report of

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.