"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Are there some > > special flags that SQLite could pass to CreateFileW() to > > trick windows into doing a better job of caching temp > > files? > > FILE_ATTRIBUTE_TEMPORARY > A file is being used for temporary storage. File systems avoid writing > data back to mass storage if sufficient cache memory is available, > because an application deletes a temporary file after a handle is > closed. In that case, the system can entirely avoid writing the data. > Otherwise, the data is written after the handle is closed. >
I went to implement this suggestion and quickly discovered that SQLite already uses the FILE_ATTRIBUTE_TEMPORARY flag on TEMP tables. Or at least I think it does. Can somebody with a symbolic debugger that runs on windows please confirm that the marked line of code in below (found in os_win.c) gets executed when using TEMP tables: int sqlite3WinOpenExclusive(const char *zFilename, OsFile **pId, int delFlag){ winFile f; HANDLE h; DWORD fileflags; void *zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ return SQLITE_NOMEM; } assert( *pId == 0 ); fileflags = FILE_FLAG_RANDOM_ACCESS; #if !OS_WINCE if( delFlag ){ /****** The following line should run when opening a TEMP table ******/ fileflags |= FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE; } #endif -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------