# Just only delete with query

**URL:** <https://forums.percona.com/t/just-only-delete-with-query/26232>\
**Category:** Percona Toolkit\
**Tags:** percona\
**Created:** [October 30, 2023, 5:42am UTC](https://forums.percona.com/t/just-only-delete-with-query/26232 "2023-10-30T05:42:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![seqwait](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/seqwait/32/12115_2.png) [@seqwait](https://forums.percona.com/u/seqwait)\
**Post date:** [October 30, 2023, 5:42am UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/1 "2023-10-30T05:42:36Z")

</div>

i just want delete table row by where without query

example user\_login\_record i just want delete by login\_at  
“delete from user\_login\_record where login\_at \< ‘2022-10-10’” without query just delete by where

what should I do? 😭

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 30, 2023, 2:36pm UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/2 "2023-10-30T14:36:00Z")

</div>

Hello @seqwait,  
Can you provide more info? Are you trying to use a Percona Toolkit tool? If so, which tool? What command have you tried so far?

---

<div class="post-metadata">

**Author:** ![seqwait](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/seqwait/32/12115_2.png) [@seqwait](https://forums.percona.com/u/seqwait)\
**Post date:** [October 31, 2023, 12:59am UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/3 "2023-10-31T00:59:30Z")

</div>

> [@matthewb](#):
>
> Can you provide more info? Are you trying to use a Percona Toolkit tool? If so, which tool? What command have you tried so far?

the command , i just want execute "delete from table where date \< ‘date’ " no query, just only delete no query first .

```auto
pt-archiver --source D=${DB},t=${table},A=utf8mb4,i=idx_date \
  --where "date < '${bound}'" \
  --progress=${RN} \
  --txn-size=${TXN} \
  --bulk-delete \
  --limit=${RN} \
  --local \
  --purge \
  --sleep=1 \
  --statistics

```

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 31, 2023, 1:06am UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/4 "2023-10-31T01:06:13Z")

</div>

What you have is exactly what you need. What is happening that is wrong?

Try running with `PTDEBUG=1 pt-archiver ...` to see much more SQL

---

<div class="post-metadata">

**Author:** ![seqwait](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/seqwait/32/12115_2.png) [@seqwait](https://forums.percona.com/u/seqwait)\
**Post date:** [October 31, 2023, 1:32am UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/5 "2023-10-31T01:32:50Z")

</div>

> [@seqwait](#):
>
> ```auto
> pt-archiver --source D=${DB},t=${table},A=utf8mb4,i=idx_date \
> --where "date < '${bound}'" \
> --progress=${RN} \
> --txn-size=${TXN} \
> --bulk-delete \
> --limit=${RN} \
> --local \
> --purge \
> --sleep=1 \
> --statistics
> 
> ```

it seem the above command first exec “select xx from table” fist the exec “delete from table where …”  
i just want exec "delete table " no query fist. how ?

---

<div class="post-metadata">

**Author:** ![Abhinav\_Gupta](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/abhinav_gupta/32/6262_2.png) [@Abhinav\_Gupta](https://forums.percona.com/u/Abhinav_Gupta)\
**Post date:** [October 31, 2023, 2:55pm UTC](https://forums.percona.com/t/just-only-delete-with-query/26232/6 "2023-10-31T14:55:45Z")

</div>

This is the default way of pt-archiver working steps. You can check more details about this under --limit option.

–limit[¶](https://docs.percona.com/percona-toolkit/pt-archiver.html#cmdoption-pt-archiver-limit)

type: int; default: 1

Number of rows to fetch and archive per statement.

**Limits the number of rows returned by the SELECT statements that retrieve rows to archive.** Default is one row. It may be more efficient to increase the limit, but be careful if you are archiving sparsely, skipping over many rows; this can potentially cause more contention with other queries, depending on the storage engine, transaction isolation level, and options such as [`--for-update`](https://docs.percona.com/percona-toolkit/pt-archiver.html#cmdoption-pt-archiver-for-update).
