# mco_trans_set_unused_versions_limit

> Set the maximum number of “unused versions” retained by the MVCC Transaction Manager.

### Prototype

        int mco_trans_set_unused_versions_limit( /*IN*/ mco_db_h db,
                                /*IN*/ int max_unused_versions );

### Arguments

db | The database handle that was established by `mco_db_connect()`
max_unused_versions | The new limit to set for unused versions in the current connection

### Description

> This function sets the maximum number of “unused versions” retained by the MVCC Transaction Manager. Once the limit is reached, the Transaction Manager turns on “exclusive mode” and removes all unused versions (cleans up indexes).

### Return Codes

Integer | Previous limit

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            mco_db_h db;
            MCO_RET rc;
            mco_device_t       dev;
            mco_db_params_t    db_params;
            mco_trans_h t;
            int limit = 100;

            ...
            rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
            if ( MCO_S_OK != rc )
            {
                rc = mco_db_connect(  dbname, &db );
                ...
                limit = mco_trans_set_unused_versions_limit( db, limit);
                printf("\nThe previous Unused Versions limit was %d.", limit );
            }
            ...
        }

### Files

Header file:
mco.h
Source file:
mursiw.c
Library:
libmcotexcl.a
Header file:
mco.h
Source file:
mursiw.c
Library:
libmcotmursiw.a
Header file:
mco.h
Source file:
mvcc.c
Library:
libmcotmvcc.a
Header file:
mco.h
Source file:
mursiw.c
Library:
libmcotread.a