简体   繁体   English

选择查询超出 MS Access System Resources

[英]MS Access System Resources exceeded with select query

I saw this question asked a few times here but none i saw seemed to address my specific issue.我在这里看到这个问题问了几次,但我看到的似乎都没有解决我的具体问题。 I have a select query that is pulling from 2 linked tables.我有一个从 2 个链接表中提取的选择查询。 When i run the query about 5 min later i get an error saying system resources exceeded.当我大约 5 分钟后运行查询时,我收到一条错误消息,指出超出系统资源。 Any idea how i can fix this?知道我该如何解决这个问题吗? Below is my query, The two tables are rather large with 146k rows and 24 columns in one and 312K rows and 67 columns in the other.下面是我的查询,这两个表相当大,一个有 146k 行和 24 列,另一个有 312K 行和 67 列。 Is this just too much data for Access?这对于 Access 来说是不是太多数据了?

SELECT [Learner Name]=[learning item number] AS [Key],
   Date()                                AS [Business Day],
   [business day] - [updated due date]   AS [Days Overdue],
   Iif([days      overdue] > 0, "true", "false")    AS [Greater Than Zero],
   assignments.[standard id],
   assignments.[learner name],
   [email]                               AS [Email Address],
   active_workforce.employee_status,
   active_workforce.employee_type,
   active_workforce. [bank title desc],
   assignments.[learning item number],
   assignments.[learning item      name],
   assignments.[learning item type],
   assignments.[enrollment record status],
   assignments.[enrollment record substatus],
   assignments.[enrollment type],
   assignments.[enrolled on date],
   assignments.[due date],
   Iif([due date] BETWEEN #3 / 16 / 2020 # AND #7 / 31 / 2020 # ,
   [due date] + 30,
   [due date])                           AS [Update Due Date],
   assignments.[upcoming or overdue],
   assignments.[business unit],
   assignments.department,
   active_workforce.job_code,
   assignments.job,
   assignments. [legal employer],
   assignments.[manager name],
   assignments.[manager sid],
   assignments. [location name],
   assignments.position,
   active_workforce.start_dt,
   active_workforce.cost_ctr_nbr,
   active_workforce.cost_ctr_desc,
   active_workforce.city,
   active_workforce.country_name,
   active_workforce.region_code,
   active_workforce.company,
   active_workforce.level_02_manager_sid,
   active_workforce.level_02_manager,
   active_workforce.level_03_manager_sid,
   active_workforce.level_03_manager,
   active_workforce.level_04_manager_sid,
   active_workforce.level_04_manager,
   active_workforce.level_05_manager_sid,
   active_workforce.level_05_manager,
   active_workforce.level_06_manager_sid,
   active_workforce.level_06_manager,
   active_workforce.level_07_manager_sid,
   active_workforce.level_07_manager,
   active_workforce.level_08_manager_sid,
   active_workforce.level_08_manager,
   active_workforce.level_09_manager_sid,
   active_workforce.level_09_manager,
   active_workforce.level_10_manager_sid,
   active_workforce.level_10_manager,
   active_workforce.[lob code],
   active_workforce.[lob      description],
   active_workforce.[sub lob code],
   active_workforce.[sub lob      description],
   active_workforce.[level 7 code],
   active_workforce.[level 7      description],
   active_workforce.[level 8 code],
   active_workforce.[level 8      description],
   active_workforce.[level 9 code],
   active_workforce.[level 9      description],
   active_workforce.[level 10 code],
   active_workforce.[level 10      description],
   active_workforce.[level 11 code],
   active_workforce.[level 11      description],
   active_workforce.[level 12 code],
   active_workforce.[level 12      description],
   active_workforce.[level 13 code],
   active_workforce.[level 13      description],
   active_workforce.[level 14 code],
   active_workforce.[level 14      description]
FROM   assignments
   INNER JOIN active_workforce
           ON assignments.[standard id] = active_workforce.sid; 

Break this query into several simpler ones, and write temporary tables for the intermediate results of each query.把这个查询分解成几个更简单的查询,每个查询的中间结果写临时表。 Recombine the data into a final result using one or more final queries.使用一个或多个最终查询将数据重组为最终结果。


Actually, this query (once I formatted it for easier reading) doesn't seem all that complicated.实际上,这个查询(一旦我对其进行了格式化以便于阅读)似乎并没有那么复杂。 Check to make sure you have indices on each side of the assignments.[standard id] = active_workforce.sid inner join.检查以确保您在assignments.[standard id] = active_workforce.sid每一侧都有索引assignments.[standard id] = active_workforce.sid内连接。 Without indices, Access might be trying to assemble the whole thing in memory, which sounds like too much given your stated specifications.如果没有索引,Access 可能会尝试在内存中组装整个内容,考虑到您指定的规格,这听起来太多了。

Alternatively, put this data into a SQL Server Express database, and let SQL Server handle it.或者,将此数据放入 SQL Server Express 数据库,让 SQL Server 处理它。 But you're still going to need indices on assignments.[standard id] and active_workforce.sid .但是你仍然需要在assignments.[standard id]active_workforce.sid

Create the simplest query to select the records:创建最简单的查询来选择记录:

SELECT
    assignments.[standard id]
FROM
    assignments
INNER JOIN 
    active_workforce
    ON assignments.[standard id] = active_workforce.sid;

Save this and create a new query having the saved query as source and include a left outer join to each of the tables to pull the relevant fields from these.保存它并创建一个新的查询,将保存的查询作为源,并包括到每个表的左外连接以从这些表中提取相关字段。 Check, that this runs.检查,这运行。

Finally, add your expressions.最后,添加您的表达式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM