On Mon, May 5, 2014 at 4:53 PM, Patrick Donnelly <[email protected]>wrote:
> Hi,
>
> I have an INSERT that looks like
>
> INSERT INTO T
> SELECT ...
>
> which I'm running numerous times a second that generally does nothing
> because the SELECT returns no rows. Unfortunately, I've found that
> SQLite still does numerous disk writes anyway in this situation.
>
I'm unable to reproduce this behavior. Here is my test script:
CREATE TABLE t1(a,b,c);
INSERT INTO t1 VALUES(1,2,3),(7,8,9),(4,5,6);
CREATE TABLE t2(x,y,z);
.print ---------------------------------
INSERT INTO t2 SELECT * FROM t1 WHERE a>10;
Then running vfstrace after the ------- I see:
trace.xLock(test.db,SHARED) -> SQLITE_OK
trace.xAccess("/home/drh/sqlite/bld/test.db-journal",0) -> SQLITE_OK, out=0
trace.xFileSize(test.db) -> SQLITE_OK, size=3072
trace.xRead(test.db,n=16,ofst=24) -> SQLITE_OK
trace.xFileSize(test.db) -> SQLITE_OK, size=3072
trace.xAccess("/home/drh/sqlite/bld/test.db-wal",0) -> SQLITE_OK, out=0
trace.xFileSize(test.db) -> SQLITE_OK, size=3072
trace.xLock(test.db,RESERVED) -> SQLITE_OK
trace.xLock(test.db,EXCLUSIVE) -> SQLITE_OK
trace.xFileControl(test.db,22) -> 12
trace.xUnlock(test.db,SHARED) -> SQLITE_OK
trace.xDeviceCharacteristics(test.db) -> 0x00001000
trace.xUnlock(test.db,NONE) -> SQLITE_OK
trace.xDeviceCharacteristics(test.db) -> 0x00001000
trace.xUnlock(test.db,NONE) -> SQLITE_OK
trace.xClose(test.db) -> SQLITE_OK
No writes.
--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users