ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB gocql driver Executing CQL statements Paging
For AI agents: a documentation index is available at https://gocql-driver.docs.scylladb.com/master/llms.txt. A Markdown version of this page is at https://gocql-driver.docs.scylladb.com/master/statements/paging.md.

PagingΒΆ

Automatic paging uses ClusterConfig.PageSize, or the value set by Query.PageSize. Very small pages increase round trips; the default is 5000.

For manual paging, keep the returned page state opaque and pass it only to the same query and protocol version:

var pageState []byte
var eventID gocql.UUID
var payload string

for {
	iter := session.Query(
		"SELECT event_id, payload FROM events WHERE account_id = ?",
		accountID,
	).PageSize(100).PageState(pageState).Iter()

	nextPageState := iter.PageState()
	for iter.Scan(&eventID, &payload) {
		// Process the row.
	}
	if err := iter.Close(); err != nil {
		return err
	}
	if len(nextPageState) == 0 {
		break
	}
	pageState = nextPageState
}

A server can return an empty intermediate page for range or ALLOW FILTERING queries. Use Iter.Scan, Iter.LastPage, or the returned page state instead of treating an empty page as completion.

Page state contains primary-key data. Protect it with authenticated encryption before exposing it in a URL or another untrusted location. Never modify it or reuse it with a different statement or protocol version.

Was this page helpful?

PREVIOUS
Executing CQL statements
NEXT
Batch statements
  • Create an issue
  • Edit this page
ScyllaDB gocql driver
Search Ask AI
  • master
    • master
  • Quick start
  • Connecting to the cluster
    • Compression
    • Authentication
    • TLS
    • Client routes (PrivateLink / Private Service Connect)
  • Executing CQL statements
    • Paging
    • Batch statements
    • Lightweight transactions
    • Request timeouts
  • Data types
  • Load balancing
  • Retry policy configuration
  • Speculative execution
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 Sep 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3