【问题标题】:MS Access System Resources exceeded with select query选择查询超出 MS Access 系统资源
【发布时间】:2021-10-03 08:44:05
【问题描述】:

我看到这个问题在这里问了几次,但我看到的似乎都没有解决我的具体问题。我有一个从 2 个链接表中提取的选择查询。当我大约 5 分钟后运行查询时,我收到一条错误消息,提示超出了系统资源。知道如何解决这个问题吗?下面是我的查询,这两个表相当大,一个有 146k 行和 24 列,另一个有 312K 行和 67 列。这对于 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; 

【问题讨论】:

  • 进行压缩和修复。 -- 这应该给出一个语法错误:SELECT [Learner Name]=[learning item number] AS [Key]

标签: sql ms-access


【解决方案1】:

将这个查询分解成几个更简单的查询,并为每个查询的中间结果编写临时表。使用一个或多个最终查询将数据重新组合成最终结果。


实际上,这个查询(为了便于阅读,我对其进行了格式化)似乎并没有那么复杂。检查以确保在assignments.[standard id] = active_workforce.sid 内连接的每一侧都有索引。如果没有索引,Access 可能会尝试将整个内容组装到内存中,这听起来有点像您声明的规范。

或者,将这些数据放入 SQL Server Express 数据库,并让 SQL Server 处理它。但是你仍然需要assignments.[standard id] 和active_workforce.sid 上的索引。

【讨论】:

  • 很遗憾,我无法访问 SQL Server。在离开 SQL 一段时间后,我又回到了 SQL 中。两边的索引是什么意思?
  • 这些也是链接表,所以我不相信我可以索引它们。可能会取消链接并创建要上传的前端
  • 您可以在后端(链接)数据库中索引[standard id] 和sid。
【解决方案2】:

创建最简单的查询来选择记录:

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

保存并创建一个新查询,将保存的查询作为源,并在每个表中包含一个左外连接,以从这些表中提取相关字段。检查它是否运行。

最后,添加你的表达式。

【讨论】:

  • 不能再链接一张表了。我不断收到错误“您输入的表达式引用了一个已关闭或不存在的对象”
  • 仔细检查 - 我猜你还没有删除表格......还有其他事情发生。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-11-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-11
  • 1970-01-01
相关资源
最近更新 更多