Performer Tag Sync

:placard: Summary High-performance bulk tagging plugin that syncs performer tags to images, galleries, and scenes
:link: Repository https://github.com/codddarrr/stashapp-plugins-repo/tree/main/plugins/performer-tag-sync
:information_source: Source URL https://codddarrr.github.io/stashapp-plugins-repo/main/index.yml
:open_book: Install How to install a plugin?

This plugin automatically applies tags from performers to their associated images, galleries, and scenes. It’s inspired by tagImagesWithPerfTags but uses direct SQL access for dramatically faster performance on large libraries.

Performance: Processes 200,000+ items in seconds instead of hours (100-1000x faster than GraphQL-based approaches).

Main features:

  • Extreme Speed: Direct SQLite access bypasses API overhead - tested with 200k images + 6k galleries + 43k scenes in 16 seconds
  • Bulk Operations: Three separate tasks for images, galleries, and scenes
  • Two Tag Modes: ADD (append tags) or SET (replace all tags)
  • Auto-Sync Hooks: Automatically sync tags when performers are added/updated (optional)
  • Smart Filtering: Exclude organized items or items with specific tags
  • Automatic Indexing: Creates optimal database indexes on first run for sustained performance
  • Schema Validation: Checks compatibility before running (currently tested with schema v72)
  • Configurable Batching: Process 5k-10k items per batch efficiently

:warning: Important: This plugin uses direct database access for speed. BACKUP YOUR DATABASE BEFORE FIRST USE. While it includes safety checks (schema validation, transactional updates, integrity checking), direct SQL is inherently more risky than using the official API. This is a conscious tradeoff for dramatic performance gains on large libraries.

Installation:

Plugin source URL: https://codddarrr.github.io/stashapp-plugins-repo/main/index.yml

Add it in Settings → Plugins → Available Plugins, then install “Performer Tag Sync”

Configuration:

After installing, go to Settings → Plugins and configure:

  • Enable for Images/Galleries/Scenes: Toggle each type independently (all enabled by default)
  • Tag Mode: ADD (append) or SET (replace all tags) - default: ADD
  • Batch Size: Items per batch (recommended: 5000-10000)
  • Exclude Organized: Skip items marked as organized
  • Exclude Tag: Skip items with a specific tag name

How it works:

  1. Go to Settings → Tasks
  2. Run “Sync Tags - All Images” (or Galleries/Scenes)
  3. The plugin will:
  • Fetch all performers and their tags
  • Find all images/galleries/scenes with performers
  • Apply performer tags to those items in bulk
  • Show progress as it processes

The plugin respects your exclusion settings and processes items in large batches for maximum speed. After running, you may need to refresh your browser (Ctrl+Shift+R) to see updated tag counts in the UI.

Real-world example: Library with 200,700 images, 5,760 galleries, and 42,664 scenes processed in 16 seconds.

Recommended workflow:

  1. Backup your database first
  2. Test on a small subset using exclusion settings
  3. Verify results before running on entire library
  4. Enable auto-sync hooks if you want automatic tagging going forward

GitHub: GitHub - codddarrr/stashapp-plugins-repo

Let me know if you run into any issues or have suggestions.

Not seal of approval from me but it passes the sniff test for your SQL code.

My recommendation would be, since you’re interacting with stash to activate and flush the WAL and follow some of the guidelines listed in Database connection pool refactor by WithoutPants · Pull Request #5274 · stashapp/stash · GitHub so you can seperate out concurrent reads and avoid write locks especially since you’re doing concurrent access while the database is still live.

1 Like

Thanks for the second pair of eyes. I’ll take a look at that, appreciate you.

Edit: incorporated some of the feedback, thanks again.