# pt-archiver use of indexes

**URL:** <https://forums.percona.com/t/pt-archiver-use-of-indexes/4845>\
**Category:** Percona Toolkit\
**Created:** [April 18, 2016, 7:54am UTC](https://forums.percona.com/t/pt-archiver-use-of-indexes/4845 "2016-04-18T07:54:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvanhaute](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bvanhaute](https://forums.percona.com/u/bvanhaute)\
**Post date:** [April 18, 2016, 7:54am UTC](https://forums.percona.com/t/pt-archiver-use-of-indexes/4845/1 "2016-04-18T07:54:31Z")

</div>

I am trying to optimize our use of the pt-archiver to archive historical data from a large database. For each table we have defined an index on the columns used in the --where clause, in order to speed up selection. By default these indexes are not used in the queries that pt-archiver is generating to select data to archive, because the select statements include a force index for the primary key instead. However, when I include the index as -i option in the --source parameter, the pt-archiver now uses the indexes as intended, but generates a delete statement that also uses the columns of that index instead of doing a delete by primary key. Is there any way I can have a mix of both:

- use an given index for selecting rows to archive
- use primary key for deleting archived rows.
