Temporary file

From Wikipedia, the free encyclopedia

A temporary file is a computer file used to store information for a short time; the file is then deleted after its use. They are often stored in a temporary folder and/or with the .TMP file extension.

Temporary files are usually created by applications that need to store information that is either too big for storage in RAM or that needs to be saved in non-volatile memory (such as a hard drive). An example of data requiring non-volatile storage would be any data needed after a computer reboots, since after this data would be lost if it were stored in the RAM memory.

Microsoft Windows uses many temporary files to store data about the users' web browsing history and settings. The most common files associated with Windows temporary files are index.dat and the entire "Cookies" folder under "Documents and Settings" that stores HTTP cookies.

Some programs create temporary files and then leave them behind. This can happen because the program crashed or because the developer of the program simply forgot to add the code needed to delete the temporary files after the program is done with them. The temporary files left behind by the programs accumulate over time and can take up a lot of disk space. A recent series of system utilities, called temporary file cleaners or disk cleaners, have appeared to address this issue.

[edit] Temporary database files

While some could perhaps argue that any file is a database file of sorts, there are temporary files specific to the sorts of programs clearly recognized as database programs. (As distinct from file systems, temporary files for application programs and so on.)

Databases may create temporary files for a variety of reasons. For example:

  • Temporary result sets based on database queries. (Likely an intermediate result set created such that this set is available for additional work.)
  • Temporary sort tables resulting when sorting functions are launched.
  • Temporary files to service distributed database needs. (That is, file systems for databases may span multiple machines, clusters of machines or remote networks and in these cases there may be advantages to temporary file storage in one or more locations.)
  • Temporary files to service a special, particular need within a secure area such that users or applications may have permissions to only that data and not any master database from which it has been drawn.
  • A common purpose for creating temporary files may be to use them for reporting queries such that core database files, (which may be getting updated via other means), are not overly taxed.

Such tempoary files may be automatic and inherent to the program when an operation is performed; or temporary file creation may occur when explicitly specified by the user. Which method is used depends on the program and task at hand. For example, it's possible that a particular database application inherently requires use of temporary tables when joining multiple tables before coming up with an answer to a query. Or it's possible a temporary table may be used for internal optimization reasons particular to the database application.

[edit] See also

In other languages