Results 1 to 3 of 3
  1. #1
    ryanjames17 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2014
    Location
    Houston TX
    Posts
    5

    Alternative to Domain aggregate functions - are there that run faster when generating running sums a

    I’m building some big production databases that import oil and gas production data and condition it for analysis. These queries are running on a table that has 50,000 rows to well over 1,000,000 rows. It’s painfully slow when it’s a couple hundred thousand records but takes all day when it’s closer to a million.
    I’m running an 8 core machine with 16bg of Ram and a 32 bit version of access. It would be a pain but I could potentially run this on a 64bit machine but I don’t know if that would make much difference.


    Are there alternative to generating this data using another function or query? Thanks for your input.

    The first query takes a series of sequential dates and generates a running count of the number of months something has been producing.

    First Query:
    UPDATE [Monthly Production] SET [Monthly Production].[Producing Month] = DCount("[P_Date]","[Monthly Production]","[P_Date]<=#" & [P_Date] & "# And [Entity]='" & [Entity] & "'");

    The second query is a Make table Query with a select query nested inside of it. The select query generates several cumulative running totals using the DSum function and then the Make table query writes those results to a new table to make it easier to access the data later.

    Second Query:
    SELECT INT_RunningTotals.Entity1, INT_RunningTotals.Prod_Mo, INT_RunningTotals.RunDays, INT_RunningTotals.RunOil, INT_RunningTotals.RunGas, INT_RunningTotals.RunBoe, INT_RunningTotals.RunWater INTO y_INT_RunningTotals
    FROM INT_RunningTotals;

    INT_RunningTotals Query:
    SELECT [Monthly Production].Entity AS Entity1, [Monthly Production].[Producing Month] AS Prod_Mo, Sum([Monthly Production].Liquid) AS Oil, Sum([Monthly Production].Gas) AS Gas, Sum([Monthly Production].BOE) AS Boe, Sum([Monthly Production].Water) AS Water, Sum([Monthly Production].[Days On]) AS DaysOn, DSum("[DaysOn]","[INT_RunningTotals]","[Entity1]='" & [Entity] & "'And [Prod_Mo]<=" & [Producing Month]) AS RunDays, DSum("[Oil]","[INT_RunningTotals]","[Entity1]='" & [Entity] & "'And [Prod_Mo]<=" & [Producing Month]) AS RunOil, DSum("[Gas]","[INT_RunningTotals]","[Entity1]='" & [Entity] & "'And [Prod_Mo]<=" & [Producing Month]) AS RunGas, DSum("[Boe]","[INT_RunningTotals]","[Entity1]='" & [Entity] & "'And [Prod_Mo]<=" & [Producing Month]) AS RunBoe, DSum("[Water]","[INT_RunningTotals]","[Entity1]='" & [Entity] & "'And [Prod_Mo]<=" & [Producing Month]) AS RunWater
    FROM [Monthly Production]
    GROUP BY [Monthly Production].Entity, [Monthly Production].[Producing Month]
    ORDER BY [Monthly Production].Entity, [Monthly Production].[Producing Month];

    Enlink.zip

    Here is an example database with the queries as well.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Textbox on report has a RunningSum property. This is the easiest and fastest performing method. Running sums in query and/or form is not easy. If this YTD example does not suit your needs then that leaves domain aggregates http://allenbrowne.com/subquery-01.html#YTD

    Also might be of interest
    http://allenbrowne.com/AppInventory.html
    http://allenbrowne.com/ranking.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,728
    Access is single threaded, so I don't think the 8 cores are going to be a big benefit unless they're doing other processes. Do you have any proof/stats that show more than 1 core is being tasked/used by Access?

    Domain Aggregate functions are notorious for being slow, especially on larger volumes of data.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-23-2014, 06:06 PM
  2. Replies: 8
    Last Post: 03-26-2014, 02:23 PM
  3. Including aggregate functions in a query
    By frind in forum Queries
    Replies: 2
    Last Post: 04-19-2013, 11:50 AM
  4. Finding Max of two nested aggregate functions in SQL
    By SummertimeClothes in forum Queries
    Replies: 1
    Last Post: 10-30-2012, 12:00 PM
  5. aggregate functions
    By gsrikanth in forum Access
    Replies: 3
    Last Post: 07-10-2012, 03:56 PM

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