Skip to main content

What are iterators?

Iterators in Pixeltable are specialized tools for processing and transforming media content. They efficiently break down large files into manageable chunks, enabling analysis at different granularities. Iterators work seamlessly with views to create virtual derived tables without duplicating storage. In Pixeltable, iterators:
  • Process media files incrementally to manage memory efficiently
  • Transform single records into multiple output records
  • Support various media types including documents, videos, images, and audio
  • Integrate with the view system for automated processing pipelines
  • Provide configurable parameters for fine-tuning output
Iterators are particularly useful when:
  • Working with large media files that can’t be processed at once
  • Building retrieval systems that require chunked content
  • Creating analysis pipelines for multimedia data
  • Implementing feature extraction workflows

Core concepts

Document Splitting

Split documents into chunks by headings, sentences, or token limits

Video Processing

Extract frames at specified intervals or counts

Image Tiling

Divide images into overlapping or non-overlapping tiles

Audio Chunking

Split audio files into time-based chunks with configurable overlap
Iterators are powerful tools for processing large media files. They work seamlessly with Pixeltable’s computed columns and versioning system.

Available iterators

Parameters

  • separators: Choose from ‘heading’, ‘sentence’, ‘token_limit’, ‘char_limit’, ‘page’
  • limit: Maximum tokens/characters per chunk
  • metadata: Optional fields like ‘title’, ‘heading’, ‘sourceline’, ‘page’, ‘bounding_box’
  • overlap: Optional overlap between chunks

Common use cases

Document Processing

Split documents for:
  • RAG systems
  • Text analysis
  • Content extraction

Video Analysis

Extract frames for:
  • Object detection
  • Scene classification
  • Activity recognition

Image Processing

Create tiles for:
  • High-resolution analysis
  • Object detection
  • Segmentation tasks

Audio Analysis

Split audio for:
  • Speech recognition
  • Sound classification
  • Audio feature extraction

Example workflows

Best practices

Memory Management

  • Use appropriate chunk sizes
  • Consider overlap requirements
  • Monitor memory usage with large files

Performance

  • Balance chunk size vs. processing time
  • Use batch processing when possible
  • Cache intermediate results

Tips & tricks

When using token_limit with document_splitter, ensure the limit accounts for any model context windows in your pipeline.

Custom iterators with @pxt.iterator

You can create your own iterators using the @pxt.iterator decorator on a Python generator function. This is the simplest way to define a custom iterator that splits one row into many.
Use unstored_cols to mark columns that should not be persisted:

Custom Iterators Cookbook

Step-by-step guide to building custom iterators

Additional resources

Split Data into Rows

All built-in iterators

Document Chunking

Chunk documents for RAG

Frame Extraction

Extract video frames
Last modified on July 14, 2026