什么是执行64个以上表格SQLite中加入了最快的方法是什么? [英] What is the fastest method for performing more than 64 table joins in SQlite?

查看:195
本文介绍了什么是执行64个以上表格SQLite中加入了最快的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算在生成的SQLite将涉及很多连接上12桌,将超过64表中的SQLite联接限制查询。 (〜250表连接或可能更多),这将在Android最终被运行。这背后的目的是根据正在生成的报告有结果集的用户定义的字段的X数量。

I'm planning on generating queries for SQLite that will involve many joins on 12 tables that will surpass the 64 table join limit in SQLite. (~250 table joins or possibly more) This will be running on android eventually. The purpose behind this is to have X amount of user defined fields in the result set depending on the report that is being generated.

不幸的是,我不是一个DBA,我不知道一个最佳的方式实现这一目标。

Unfortunately I'm not a DBA and I do not know of an optimal way to achieve this.

到目前为止,我觉得有三种选择:

So far I think the options are:


  • 使用2临时表来玩弄的结果,而加入量最大可能的设置。 (SQLServer的在我的previous解决方案,速度相当慢)

  • 产生结果集数列和一键加入并把它们存储在 N 临时表。 (这里的 N 小于64),然后加入自己的公用密钥,所有临时表。

  • 创建一个临时表,并在同一时间补上的一个插入或更新。

  • 请不要做一个大的加盟,执行许多选择,而不是和填补一些数据容器的。

  • Use 2 temp tables to juggle the result set while joining the max amount possible. (My previous solution in SQLServer, fairly slow)
  • Produce result sets of a few columns and a key to join on and store them in n temp tables. (Where n is less than 64) Then join all the temp tables on their common key.
  • Create a single temp table and fill it up one insert or update at a time.
  • Don't do a big join, perform many selects instead and fill up some sort of data container.

有没有别的东西,我应该考虑的?

Is there something else I should consider?

推荐答案

根据您的评论对Mike的回应,查询生成报表需要加入并重新加入很多很多次。

Per your comment on Mike's response, "the query to generate the report needs to join and rejoin many many times".

通常情况下,使用报表打交道时,你会想你的查询拆分成一口大小的块,并存储在临时表中间结果如适用。

Frequently, when dealing with reports, you'll want to split your query into bite-size chunks, and store intermediary results in temporary tables where applicable.

另外,你的问题使得它听起来就像你的实体/属性/值存储,并试图转动整个事情。如果是这样,你可能想用这个设计反模式重新审视,因为它可能是你的问题的根源。

Also, your question makes it sound like you've an entity/attribute/value store and trying to pivot the whole thing. If so, you may want to revisit using this design anti-pattern, since it probably is at the source of your problem.

这篇关于什么是执行64个以上表格SQLite中加入了最快的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆