Hi! All,

After using strace, we found the root cause.
SQLite will use some temporary files to keep the select (with union all) 
result.
See: http://www.sqlite.org/tempfiles.html

In our system, we allocated 32M for /, and there are only 19M after 
booting up the system.
SQLite can not get enough space for the temporary files (strace shows 
"write error: space is not enough")
After adding a compiling configuration -DSQLITE_TEMP_STORE=3 to SQLIte's 
Makefile, we can finish this job.
http://www.sqlite.org/compile.html#temp_store

Also, we can change the location of the temporary files to solve this 
issue.

France Hsu wrote:
> Hi! All,
>
> We recently got an error "Disk I/O error" while using the select 
> command on attached DBs.
> These DBs have same table format
> We only execute select, insert, and attach commands
>
> The environment is as follows:
> SQLite: V3.5.6
> OS: Linux 2.6.24.2
> Platform Power PC (MPC8543)
> Memory: 256M
> DB Location: SATA hard drive, within a 512-maga-byte partition
>
> The error is happened when the size of one DB file is larger than 10M,
> Ex:
> -rw-r--r--    1 root     root     10600448 Aug  1 14:38 system_log-07.db
> -rw-r--r--    1 root     root        27648 Aug  7 22:18 system_log-08.db
>
> ./sqlite3 system_log-08.db
> sqlite> attach ''system_log-07.db' as db1;
> sqlite> select * from main.disk_log union all select * from 
> db1.disk_log order by timestamp desc;
> SQL error: disk I/O error
>
> Available partition size: 467.2M
> Sometimes I executed the command "select count(*) ..." successfully, 
> but sometimes failed.
> The total number of the result is about 150000.
> Sometimes I executed the command "select * ... limit 0, 30000" 
> successfully, but sometimes failed.
> As observing top when executing sqlite, the available memory is enough 
> (about 120-140M).
>
> Would you provide some comments or some solutions?
> Thank you all very much.
>

-- 

Best Regards,
France Hsu 


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to