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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:35:49+00:00 2026-06-01T14:35:49+00:00

I have a query that will be put into a procedure, and it will

  • 0

I have a query that will be put into a procedure, and it will create a report of id’s. The WHERE clause for my query (not the one in the inner view) is the cause of the long run time. This query takes about twelve minutes, and I was wondering if you guys had any tips on shortening the run time. Or even if there is a way to not show records/rows if the balance = 0 in the pl/sql code of the procedure, rather than in the query.

SELECT x.arp_person_id AS student_id,
   xf_ar_charges(x.arp_person_id, '2008FL') as charges,
   xf_ar_pymts(x.arp_person_id,'2008FL') as payment,
   (xf_ar_charges(x.arp_person_id, '2008FL') 
                                    - (xf_ar_pymts(x.arp_person_id,'2008FL')) AS balance
  FROM (select distinct arp_person_id 
          from ar_payments
          WHERE arp_fa_transmittal IS NOT NULL
   AND ('N' = 'N' OR arp_date BETWEEN TO_DATE('11/01/2008','MM/DD/YYYY')
   AND TO_DATE('12/31/2008','MM/DD/YYYY')) 
   AND ('Y' = 'N' OR arp_term IN ('2008FL', 'N')) ) x 
  WHERE (xf_ar_charges(x.arp_person_id, '2008FL') 
                                         - (xf_ar_pymts(x.arp_person_id,'2008FL')) != 0;
  • 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-01T14:35:49+00:00Added an answer on June 1, 2026 at 2:35 pm

    Assuming that you are correct and that the majority of the time is being spent executing the two functions xf_ar_charges and xf_ar_pymts (note that this is the logical implication of the implication that it is the outer WHERE clause that is creating the performance problem) the two most likely approaches to improve performance would be to optimize the code behind those procedures or to move the logic out of those procedures and embed it in the SQL statement itself. Without knowing more about your data and your code, it’s hard to suggest which of these would be more likely to improve performance or how to go about optimizing the functions (nor, of course, is it possible for anyone to confirm that it really is the outer WHERE clause that is causing the performance problem).

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

Sidebar

Related Questions

I have a button that will delete all users that fits into this query:
I have a simple query: $query = new WP_Query('showposts=5'); that will obviously display 5
The following query will display all Dewey Decimal numbers that have been duplicated in
The Query Optimizer is estimating that the results of a join will have only
I have a query that selects data into a custom type- UserData curData =
SETUP I put a mp3 into my bundle just for testing, i will have
mysql_query(INSERT INTO dictionary ('word', 'definition') VALUES ('.$word.','.$definition.');) That just will not execute, when I
I have written a complex query that will return me a list of IDs.
I'm trying to construct a query that will map two columns, one, a date
I am using in C# MYsql .I have query that works if I run

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.