Results 1 to 6 of 6
  1. #1
    shawnvon is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Aug 2016
    Posts
    2

    Slow running query

    Hi, is there any better way to run this so it doesn't take ~45-1min?

    SELECT
    tblISR.ID,
    tblISR.Source,
    tblISR.Entity,
    tblISR.BillTypeMne,
    tblISR.SubmittedTo,
    Last(tblES.Payor) AS LastOfPayor,
    tblPayorsLegend.planNormalname,
    tblISR.EncounterID,
    tblISR.CertificateNumber,
    tblISR.Last,
    tblISR.First,
    tblISR.Dob,
    tblES.AccountNumber,
    tblISR.DateofService,
    tblISR.ProcCode,
    tblISR.ProcedureDescr,
    Last(tblISR.DxOneCode) AS LastOfDxOneCode,
    Last(tblISR.DxTwoCode) AS LastOfDxTwoCode,
    Last(tblISR.DxThreeCode) AS LastOfDxThreeCode,
    Last(tblISR.DxFourCode) AS LastOfDxFourCode,
    tblISR.ProviderName,


    tblISR.Qty,
    tblISR.AmtBilled,
    tblISR.DateBilled,
    tblISR.AppAmt,
    tblISR.AmtPaid,
    tblISR.DatePaid,
    Sum([rate]*IIf(IsNull([Qty])=True,1,[Qty])) AS contractRate,
    Sum(tblES.PaidAmount) AS SumOfPaidAmount,
    [contractRate]-[SumofPaidAmount] AS variance,
    Last(tblES.CheckNo) AS LastOfCheckNo,
    Last(tblES.checkDate) AS LastOfcheckDate, tblISR.Comments
    FROM tblRates INNER JOIN
    ((tblISR INNER JOIN tblES ON (tblISR.[AmtBilled] = tblES.[TotalCharges]) AND
    (tblISR.[PatientAccount] = tblES.AccountNumber) AND
    (tblISR.[ProcCode] = tblES.[CPTCode]))
    INNER JOIN tblPayorsLegend ON tblISR.[HealthPlanNm] = tblPayorsLegend.planName) ON (tblRates.cpt = tblES.[CPTCode]) AND
    (tblRates.planAbbrev = tblPayorsLegend.planAbbrev)
    WHERE (((tblISR.DateofService) Between [effectiveDate] And [endDate]))
    GROUP BY
    tblISR.ID,
    tblISR.Source,
    tblISR.Entity,
    tblISR.BillTypeMne,
    tblISR.SubmittedTo,
    tblPayorsLegend.planNormalname,
    tblISR.EncounterID,
    tblISR.CertificateNumber,
    tblISR.Last,
    tblISR.First,
    tblISR.Dob,
    tblES.AccountNumber,
    tblISR.DateofService,
    tblISR.ProcCode,
    tblISR.ProcedureDescr,
    tblISR.ProviderName,
    tblISR.Qty,
    tblISR.AmtBilled,
    tblISR.DateBilled,
    tblISR.AppAmt,
    tblISR.AmtPaid,
    tblISR.DatePaid,
    tblISR.Comments,
    tblES.CPTCode
    ORDER BY tblISR.Last, tblISR.DateofService, tblISR.ProcCode;
    __________________________________________________ __

    Where tblISR is claims and tblES are payments for those claims

    If mre information is needed please let me know, this is my first post in Acces forums.

    I appreciate the help in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    is this a local db? remote sql/oracle?
    are there lots of records? 100k? more?
    have you compressed the tables?
    are there users in the db while you run it?

  3. #3
    shawnvon is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Aug 2016
    Posts
    2

    Thanks

    Quote Originally Posted by ranman256 View Post
    is this a local db? remote sql/oracle?
    are there lots of records? 100k? more?
    have you compressed the tables?
    are there users in the db while you run it?
    Thanks for the reply.

    The db is on a shared network drive

    There are about 50K records in the claims and payment tables each and 80K in tblRates

    Running on Access 2016 and have it set to compact and repair and compress

    Do you know of any Access add-ins that can correct any of these issues?

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    In addition toRanman's comments - are the relevant fields indexed? - ones you link, sort or filter on?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    i have found access2016 to suck and be really slow.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

    Just an FYI.....

    You have columns like
    Last(tblES.checkDate) AS LastOfcheckDate
    From HELP:

    First, Last Functions

    Remarks
    The First and Last functions are analogous to the MoveFirst and MoveLast methods of a DAO Recordset object. They simply return the value of a specified field in the first or last record, respectively, of the result set returned by a query. Because records are usually returned in no particular order (unless the query includes an ORDER BY clause), the records returned by these functions will be arbitrary


    People frequently use Last(), when they really should use Max(), to get the latest date, check number, etc..............

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access running very slow
    By dynamike in forum Access
    Replies: 2
    Last Post: 04-03-2015, 05:15 PM
  2. Database Running Slow
    By data808 in forum Access
    Replies: 2
    Last Post: 08-12-2014, 01:06 AM
  3. Query running Slow
    By mike02 in forum Queries
    Replies: 2
    Last Post: 07-26-2013, 12:47 PM
  4. Access running very slow
    By k11ngy in forum Access
    Replies: 1
    Last Post: 10-12-2012, 08:09 AM
  5. Query running VERY slow
    By purple_kittykat in forum Queries
    Replies: 4
    Last Post: 07-31-2011, 12:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums