---
id: gk-block-mcp-pattern-ref-scan-batch-size
title: "Filter - gk/block-mcp/pattern/ref-scan-batch-size"
sidebar_label: "gk/block-mcp/pattern/ref-scan-batch-size"
tags:
  - "2.0.0"
---

# Filter: gk/block-mcp/pattern/ref-scan-batch-size

Tune the memory/speed trade-off when counting pattern usage.

To work out how often each synced pattern is used, the plugin pages through post content in chunks rather than loading every row at once. Lower the batch size to shrink peak memory on a constrained host; raise it to finish the tally in fewer round-trips on a fast database. Values below 1 are clamped to 1.

## Parameters

| Name | Type | Description |
|------|------|-------------|
| $batch_size | `int` | Number of post rows pulled per chunk. Default 200. |

## Example

// Use smaller batches on a memory-limited host.

```php
add_filter( 'gk/block-mcp/pattern/ref-scan-batch-size', function () {
    return 50;
} );
```

### Since

- [2.0.0](../../since/2-0-0/)

### Source

Defined in `wordpress-plugin/gk-block-api/includes/class-pattern-manager.php` at line 561

