作者:陈俊凯660638 | 来源:互联网 | 2023-05-18 02:03
IusetemporarytablesinanSQLitebasediPhoneapplication.Performancewasnotaswasrequiredso
I use temporary tables in an SQLite based iPhone application. Performance was not as was required so I looked at various candidates for optimization. Most of these worked well and had the desired effect. However, I'd also like to try moving the temporary tables from flash into memory to see if there is any improvement.
我在基于SQLite的iPhone应用程序中使用临时表。性能不是所需的,所以我查看了各种候选优化。其中大多数都运作良好并具有预期效果。但是,我还想尝试将临时表从闪存移动到内存中,看看是否有任何改进。
On an actual device I try and configure this using:
在实际设备上,我尝试使用以下方法配置:
PRAGMA temp_store = 2;
These executes without error. However, when I query the configuration using:
这些执行没有错误。但是,当我使用以下方式查询配置时:
PRAGMA temp_store;
No results are returned so I am unable verify that this configuration is in effect. I can read other PRAGMA settings such as 'page_size'. Can anyone tell me:
没有返回结果,因此我无法验证此配置是否有效。我可以阅读其他PRAGMA设置,例如'page_size'。谁能告诉我:
- If this is expected behavior
如果这是预期的行为
- If this is an unsupported configuration in SQLite on the iPhone
如果这是iPhone上SQLite中不支持的配置
- If such an optimization would be pointless on the iPhone even if it were possible (due perhaps to the hardware)
如果这样的优化在iPhone上毫无意义,即使它是可能的(可能由硬件引起)
- How I can successfully move temporary table storage into memory in this scenario
在这种情况下,如何将临时表存储成功移动到内存中
Note: I am well aware of Core Data in SDK 3.0 but I have good reasons for not using it.
注意:我很清楚SDK 3.0中的核心数据,但我有充分的理由不使用它。
Update: jitter pointed out that the SQLite instance on the iPhone may have been compiled with SQLITE_TEMP_STORE set to always use temporary files. I wasn't aware of this setting - is there any way to confirm that this is the case?
更新:jitter指出iPhone上的SQLite实例可能已经编译,SQLITE_TEMP_STORE设置为始终使用临时文件。我不知道这个设置 - 有没有办法确认是这种情况?
2 个解决方案