# Can pt-archiver be fed a file of PK's instead of using an index

**URL:** <https://forums.percona.com/t/can-pt-archiver-be-fed-a-file-of-pks-instead-of-using-an-index/14461>\
**Category:** MariaDB Server & Utilities\
**Created:** [February 17, 2022, 8:33am UTC](https://forums.percona.com/t/can-pt-archiver-be-fed-a-file-of-pks-instead-of-using-an-index/14461 "2022-02-17T08:33:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdab100](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rdab100/32/8_2.png) [@rdab100](https://forums.percona.com/u/rdab100)\
**Post date:** [February 17, 2022, 8:33am UTC](https://forums.percona.com/t/can-pt-archiver-be-fed-a-file-of-pks-instead-of-using-an-index/14461/1 "2022-02-17T08:33:45Z")

</div>

I seems to vaguely remember that pt-archiver could be fed a file of PK values to do the nibbling for deletes or ETL extract (usually repeatable) rather than walking the index and selecting rows based on the where but cannot seem to find notes on this.

Anyone else remember doing this?

I think the method was similar to here [Complex Archival with Percona Toolkit's pt-archiver - Percona Database Performance Blog](https://www.percona.com/blog/complex-archival-with-percona-toolkits-pt-archiver/)

Thanks

Dom

---

<div class="post-metadata">

**Author:** ![Ceri\_Williams](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ceri_williams/32/1218_2.png) [@Ceri\_Williams](https://forums.percona.com/u/Ceri_Williams)\
**Post date:** [February 18, 2022, 9:03am UTC](https://forums.percona.com/t/can-pt-archiver-be-fed-a-file-of-pks-instead-of-using-an-index/14461/2 "2022-02-18T09:03:10Z")

</div>

Hi @rdab100

I was going to say that you would do it via the query in the `--where`, but that is in the article that you referenced. I don’t think that there is raw read that would do it, but you could parse the file in a script (e.g. `mapfile`) and inject those IDs into the query.

e.g.

```nohighlight
=> cat ids.txt 
1
2
3
4

=> cat archive.sh
#!/bin/bash

declare -a ID_LIST=( )
declare WHERE_CLAUSE=

mapfile -t ID_LIST < ids.txt
WHERE_CLAUSE="$(echo "${ID_LIST[*]}" | tr ' ' ,)"

echo "pt-archiver ... --where 'id in (${WHERE_CLAUSE})'"

=> bash archive.sh 
pt-archiver ... --where 'id in (1,2,3,4)'

```

Hope that helps.

Ceri
