# UX: Table view: Select all: impossible to delete over 10k entities

**URL:** <https://community.fibery.io/t/ux-table-view-select-all-impossible-to-delete-over-10k-entities/10879>\
**Category:** Bugs & Issues\
**Tags:** performance\
**Created:** [May 18, 2026, 7:01pm UTC](https://community.fibery.io/t/ux-table-view-select-all-impossible-to-delete-over-10k-entities/10879 "2026-05-18T19:01:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RonMakesSystems](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ronmakessystems/32/14122_2.png) [@RonMakesSystems](https://community.fibery.io/u/RonMakesSystems)\
**Post date:** [May 18, 2026, 7:26pm UTC](https://community.fibery.io/t/ux-table-view-select-all-impossible-to-delete-over-10k-entities/10879/2 "2026-05-18T19:26:11Z")

</div>

Please vote for this here: [Make native bulk editing actions more reliable and faster for large datasets](https://community.fibery.io/t/make-native-bulk-editing-actions-more-reliable-and-faster-for-large-datasets/9989)

I was able to hack a solution together, that worked well for this exact scenario.

A button that triggers this script, then press the button on **one** entity from the database.

You can find the button id by opening the button editor, then looking at the url.

Let me know if it works! It’s been a while since I ran this.

```auto
const fibery = context.getService('fibery');
const http = context.getService('http');

const TYPE = 'Space/Database';
const BATCH_SIZE = 3000;
const MAX_BATCHES_PER_RUN = 1;
const STOP_WHEN_REMAINING_AT_OR_BELOW = 20;

const BUTTON_URL = 'https://DOMAIN.fibery.io/api/automations/buttons/BUTTONID/runs';
const API_TOKEN = '';

const currentEntity = args.currentEntities[0];

// Since your hardcoded self-call worked with fibery/id,
// keep using that exact field shape.
const currentId =
    currentEntity['fibery/id'] ||
    currentEntity.id;

if (!currentId) {
    throw new Error('Could not determine current entity id');
}

let totalDeleted = 0;
let shouldTriggerAgain = false;

for (let i = 0; i < MAX_BATCHES_PER_RUN; i++) {
    const batch = await fibery.executeSingleCommand({
        command: 'fibery.entity/query',
        args: {
            query: {
                'q/from': TYPE,
                'q/select': ['fibery/id'],
                'q/limit': BATCH_SIZE,
                'q/offset': 0
            }
        }
    });

    if (!batch || batch.length === 0) {
        shouldTriggerAgain = false;
        break;
    }

    const idsToDelete = batch
        .map(x => x['fibery/id'])
        .filter(Boolean)
        .filter(id => id !== currentId);

    // Only current entity left in the page
    if (idsToDelete.length === 0) {
        shouldTriggerAgain = false;
        break;
    }

    // Stop near the end if only a small tail remains
    if (batch.length < BATCH_SIZE && idsToDelete.length <= STOP_WHEN_REMAINING_AT_OR_BELOW) {
        shouldTriggerAgain = false;
        break;
    }

    await fibery.deleteEntityBatch(TYPE, idsToDelete);
    totalDeleted += idsToDelete.length;

    // If we got a full page, there are probably more entities left
    if (batch.length === BATCH_SIZE) {
        shouldTriggerAgain = true;
    } else {
        shouldTriggerAgain = false;
        break;
    }
}

if (shouldTriggerAgain) {
    await http.postAsync(BUTTON_URL, {
        headers: {
            'Authorization': `Token ${API_TOKEN}`,
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        },
        body: JSON.stringify({
            entities: [{ 'fibery/id': currentId }]
        })
    });
}

return {
    deleted: totalDeleted,
    triggeredAgain: shouldTriggerAgain,
    currentId
};

```

---

_[View the full topic](https://community.fibery.io/t/ux-table-view-select-all-impossible-to-delete-over-10k-entities/10879)._
