What Is Application Database And How to Maintain it?

1. General information

Telegram applications store different types of data on your device:

  1. Photos and videos downloaded in chats. They are stored as files in the Telegram application directories, and their storage is called “cache”.
  2. Message texts and some additional service information about chats. The storage of this data is called “Database”.
  3. Technical information about all events that occur in the application is stored in special text files called “logs”.

In this article, we explain what is app database and how to keep it healthy.

2. What is Telegram App Database?

The database stores technical data that cannot be viewed in the Telegram application. Its volume is much smaller than that of the cache, but failures and errors in the database can interfere with the operation of the application much more.

Due to incorrect operation of the database, the following features may start to work incorrectly:

  1. Displaying the list of chats. Chats may not be displayed in the general list, although they are definitely there, and even successfully found by search.
  2. Downloading media from the server to the device and uploading them from the device to the server. Data may not be downloaded, or their download may hang, or after downloading it may turn out that the data was not saved. Such errors can be caused not only by database failures, but also by an overflowing cache.
  3. Downloading stories from the server to the device or from the device to the server.

Other features of the application sometimes also start to work incorrectly.

Please note: each of the accounts logged into your application has its own separate database. Therefore, in order to fix the incorrect operation of the application, you may need to log into each account one by one and clear its database.

3. What Is Database Size Which Requires Cleaning?

It is impossible to name the exact size at which it is time to clean up the database. Many users do not experience any problems when using an application with a database that takes up a whole gigabyte, while others can hardly use the application normally if the database takes up only a few dozen megabytes.

However, the authors of this article are of the opinion that the normal database size is up to 100 megabytes. But, again, this is only an approximate value.

4. How to Clean Database?

4.1. Android

  1. Go to “Settings › Data and Storage › Storage usage”.
  2. Click the button with three dots located in the upper right corner of the screen.
  3. Select “Clear Local Database”.
  4. Remember how much space it took up on your device before cleaning (this is important!).
  5. Confirm cleaning and wait for the process to complete. Cleaning the database usually takes several tens of seconds, but in some cases it can take up to 10 minutes or even longer.
  6. Click the button with three dots again and select “Clear Local Database”.
  7. See how much space the database takes up after cleaning.

The thing is that if the database has accumulated serious errors, even its self-cleaning system may start to work incorrectly. The normal size of the database after cleaning is several dozen megabytes. If the size of the database has not changed after cleaning or still exceeds 100 megabytes, then the database cleaning did not work or did not work correctly. In this case, you need to log out of your account (“Settings › button with three dots in the upper right corner of the screen › Logout › Logout”) and then log in again, after making sure that you have access to the account’s SIM card or to other devices that are logged in, and that you remember the account’s cloud password, if it is specified in the settings.

Please note: cleaning the database of one account does not affect the databases of other accounts that are logged in to your application.

Android users also have the ability to reset the chat cache. This reset sometimes also fixes some problems in the application.

  1. Go to the “Settings” section and twice tap&hold the caption with the app version number. The app will display the debug menu.
  2. In the menu that opens, select “Reset chats”.

4.2. iOS

iOS users have several different ways to clear the app database. All the necessary buttons are located in the so-called “debug menu”. To open it, quickly tap the Settings button 10 times in a row (the rightmost button at the bottom of the screen).

  1. Clear Database. Deletes all locally stored data, including secret chats. This option should be used when database optimization did not help: see point 3.
  2. Clear Database and Cache. Same as the previous point, but also clears the entire media cache.
  3. Optimize Database. A more gentle database cleanup. Leaves some data on the device, including secret chats, but sometimes also restores the correct functionality of the application.

4.3. What Will Happen After Database Cleaning?

No data will disappear from anywhere: all your messages will still remain in the chats where they were before (“Clear Database” in Telegram iOS is an exception). But the application will need some time to re-download the data that is needed for the correct and fast operation of various functions from the server. Until this data is downloaded, the application may “slow down”: for example, it will switch more slowly from one screen to another, or it will take longer to search by text. Usually, a few minutes after clearing the database, all functions will start working again no worse and no slower than before clearing, and often even faster.