# Store Statistics for Your Answer Bank

You can configure Answer Server to store some information about the usage of your Answer Bank question equivalence classes in an ODBC-compatible database.

When you configure statistics storage, Answer Server stores popularity information for your question equivalence classes. Each time the text of an Ask action matches a question equivalence class, Answer Server updates the database.

Periodically, Answer Server also queries the database for the popularity information, and uses it to update a count field in the question equivalence class. You can use this field to sort question equivalence classes by popularity in the `GetResources` action.

To configure Answer Bank to store statistics

1. Open your configuration file in a text editor.

2. Find the configuration section for the Answer Bank system for which you want to store statistics.

3. In this configuration section, set `StatsStorage` to the name of a configuration section for the statistics database details. For example:

       [MyAnswerBank]
       StatsStorage=MyStatsDB

4. (Optional) Set `UpdatePopularityInterval` to the number of seconds between updates of the question popularity field in the Answer Bank Agentstore.

   By default, Answer Server updates the field every 600 seconds (10 minutes).

   You can update the field more frequently if you need up-to-date information to sort by popularity. However, for performance reasons Micro Focus recommends that you do not update the popularity count field too frequently, because it might result in a large number of indexing operations in the Answer Bank Agentstore component.

5. (Optional) Set `PopularityWindowDays` to the number of days for which you want to consider popularity information for your question equivalence classes in the Answer Bank Agentstore.

   By default, Answer Server stores the count for the last seven days. That is, each time Answer Server updates the popularity field, it stores the number of times the question equivalence class was matched in the last week.

6. Create a configuration section for the statistics database. The name of this section must match the section you defined in the `StatsStorage` parameter in step 3. For example:

       [MyStatsDB]

7. In the statistics database configuration section, set `ConnectionString` to the connection string to use to connect to the statistics database. Answer Server passes this string on to the database, so you can use a connection string that works in any SQL client application. For example:

       [MyStatsDB]
       ConnectionString=Driver=PostgreSQL ANSI(x64); Server=sql-host.mycompany.com; Port=5432; Database=statsdb; Uid=postgres;password=password;

   The database that you configure must exist, but Answer Server creates all the tables that it needs to store the statistics information. The database must also be able and configured to accept dates in ISO-8601 formats (that is, `YYYY-MM-DD hh:mm:ss`).

   NOTE: On Linux operating systems, remove the spaces in the connection string.

8. (Optional) Set `Enabled` to `True`. The default value for this parameter is `True`, but you might want to set it explicitly for clarity. You can set `Enabled` to `False` if you want to stop storing the statistics.

The following example shows the complete configuration for this statistics database.

    [MyAnswerBank]
    StatsStorage=MyStatsDB
    UpdatePopularityInterval=600
    PopularityWindowDays=7

    [MyStatsDB]
    Enabled=True
    ConnectionString=Driver=PostgreSQL ANSI(x64); Server=sql-host.mycompany.com; Port=5432; Database=statsdb; Uid=postgres;password=password;

For more information about these configuration parameters, refer to the Answer Server Reference.

_FT_HTML5_bannerTitle.htm