joins across multiple sqlite db files

我是研究僧i 提交于 2019-12-30 07:45:07

问题


hey guys android has some serious limitations with file system space on certain devices and my app starts giving me errors once my sqlite db file size grows beyond 5mb and i try to run the vaccum command

i am thinking to separate my data across multiple sqlite files to break them into smaller db files so that i can simply delete the appropriate sqlite file when its data becomes obselete

that way my main sqlite file never grows too big and i dont ever need to eat up space when doing vaccum

however i wanted to know if there is a way to make inner joins work across multiple sqlite files (such that the primary data is there in my main sqlite file) and secondary data split across different sqlite files

if this isnt possible in sqlite then i guess i will have to recode stuff to work with gzipped xml files :-(


回答1:


Use ATTACH DATABASE to query more than one database in your SQL: http://www.sqlite.org/lang_attach.html




回答2:


Different databases means that they are different "things". You could query one db, them query the other db and join the two results in code (even if that includes join X on Y). But AFAIK, it's impossible to do that using sql only.



来源:https://stackoverflow.com/questions/6495204/joins-across-multiple-sqlite-db-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!