Skip to content

Performance

Use these measurements to choose an API and identify what to profile. They come from a same-zone application VM and Cloud SQL for PostgreSQL, measured in October 2026. They describe these fixtures and hardware; benchmark your own schema before setting a latency or capacity target.

Detailed measurements, schemas, and methodology follow the optimization advice.

Summary

OperationWhat to expectWhat drives the cost
CheckAbout 0.4 to 0.7 ms end to end, about 0.1 ms of it in PostgresMostly network and client overhead in the measured fixtures.
Bulk check100 checks in about 6 ms, one round tripNumber of checks in the batch
Cached checkAbout 120 nsNo database call
ListObjects, ListSubjectsUnder 1 ms to hundreds of msHow much of the permission graph Postgres has to walk (see List operations)
Contextual tuples7.4 to 10.1 ms total for 1 to 100 tuplesCreating and dropping a temporary view on each call

A check is one SQL statement. On a same-zone connection, the round trip costs more than the query: a bare SELECT 1 took 0.34 ms, and the kitchen-sink PlainUser check at the 1M label took 0.420 ms. For similar check paths, your round-trip time plus roughly 0.1 ms is a useful starting estimate, not a latency guarantee.

Choose an API and optimize

Your request needs…Start withWhy
One permission decisionCheckOne statement; measured checks are mostly network and client time.
Decisions for objects already loadedBulkCheck over those IDsAt the largest hierarchy scale, 100 checks took 6.32 ms in bulk versus 52.3 ms sequentially.
Repeated decisions with an acceptable staleness windowPermission cacheA warm hit measured 117 ns; it does not measure authorization after a permission change.
IDs accessible to a userListObjectsProfile broad or recursive relations; a small page may still be expensive.
Everyone who can access an objectListSubjectsMeasure both candidate expansion and result size; schedule broad audits outside hot request paths.
Request-specific grantsContextual tuplesInclude temporary-view setup and cleanup in the budget: 7.4–10.1 ms for the measured checks.
  1. Measure from your application. Compare a bare SELECT 1 with the authorization call on the same connection path. The 0.336 ms cloud reference is an observed baseline, not a hard lower bound.
  2. Batch checks before increasing concurrency. Batching amortizes round trips. Tune pool size against database CPU and request latency; the measured four-worker throughput is not a capacity guarantee.
  3. Index the tuple sources. Run melange doctor; inspect the tables behind your view, including casts. See Indexing.
  4. Profile expensive lists in each direction. Record returned rows, candidates, buffers, joins, and recursive work. An empty answer can still require a large traversal. See Schema shape.
  5. Use pagination to bound payloads. Verify whether the limit reduces database work. The measured first-page PR query takes roughly 0.26 seconds at limits from 10 through 500.
  6. Cache deliberately. Choose an invalidation or TTL policy that fits your permission-change requirements. The single-check cache does not cache list results; see Caching.

Indexing

Index the tables behind the melange_tuples view, including expression indexes for any ::text id casts. Missing indexes can cause scans; verify index usage in your plan before applying these measurements to your workload:

-- Composite index covering the columns the view selects
CREATE INDEX idx_org_members_lookup
    ON organization_members (organization_id, role, user_id);

-- Expression index for text id conversion
CREATE INDEX idx_org_members_text
    ON organization_members ((organization_id::text), (user_id::text));

melange doctor detects missing expression indexes. See Tuples View for indexing guidance and Scaling for alternatives such as materialized views.

To investigate a slow query on your own data, use EXPLAIN ANALYZE or the generated explain_* functions:

EXPLAIN ANALYZE SELECT check_permission('user', '123', 'viewer', 'document', '456');

Benchmark models

Scale names such as 1K and 1M are labels, not exact tuple counts. The fixtures grow users, groups, hierarchy depth, and fan-out together. The results cannot isolate tuple-count scaling or a fixed cost per feature. See Benchmark schemas for both complete FGA schemas, physical storage and indexes, seed rules, and the exact mapping from benchmark names to relations.

LabelKitchen-sink tuplesUsersGroups / chain lengthFolder depthHierarchy tuples
1K3,82420040 / 441,150
10K25,3861,000120 / 5521,000
100K155,6925,000400 / 66204,000
1M840,87725,0002,000 / 672,020,000

Checks

In the measured kitchen-sink queries, check_permission latency stayed roughly flat across a 220× range of dataset sizes (3,824 to 840,877 tuples). These are selected queries, not a bound for every relation or graph:

CheckEnd to endIn databaseNetwork and client
Union of direct, group, folder-inherited, and public grants, then an exclusion (viewer but not blocked)405 to 475 µs83 to 94 µs322 to 381 µs
Userset subject (group:eng#member)420 to 501 µs97 to 131 µs321 to 383 µs
Service account, direct grant387 to 446 µs61 to 67 µs325 to 380 µs
Intersection (editor and active)434 to 488 µs109 to 112 µs323 to 376 µs
Public subject (user:*) on the same relation407 to 485 µs86 to 96 µs321 to 389 µs

Through the Go Checker, which adds input validation and connection handling, a check took 0.41 to 0.66 ms at every size from 1,150 to 2,020,000 tuples. Across 889 check assertion benchmarks in the OpenFGA compatibility suite, the median of benchmark medians was 0.60 ms and their 90th percentile was 0.76 ms. These are not per-request latency percentiles.

Other fixed-input operations also stayed in a narrow band:

OperationEnd to endIn database
expand_permission0.39 to 0.44 ms60 to 68 µs
explain_permission (full trace)0.63 to 0.71 ms266 to 296 µs
check_permission_bulk, 3 checks across 3 object types0.83 to 0.97 ms454 to 509 µs

The Go BenchmarkCheck cases allocated about 1.3 KiB in 26 allocations per call across the measured sizes. Other APIs and cache paths have different allocation costs.

Bulk checks

Bulk checks send every check in one statement, so you pay the round trip once:

ChecksOne at a timeOne bulk call
105.1 to 6.0 ms1.3 to 1.4 ms
10052 to 65 ms4.5 to 6.4 ms
500Not measured27 to 28 ms (10K through 1M labels)

At the 1K label there are only 50 repositories, so the 500-entry batch repeats IDs and takes 4.9 ms; it is not a measurement of 500 distinct checks. Sequential cases also vary users while homogeneous bulk cases fix one user, so the comparison reflects those application patterns rather than isolating only transport overhead.

Duplicate checks in a batch are evaluated once: 100 checks with 50 distinct took 3.6 to 4.4 ms. Use BulkCheck whenever a request needs more than a couple of answers, such as filtering a page of results or rendering per-item buttons.

Concurrency

With four benchmark workers on the 21,000-tuple hierarchy fixture, direct checks achieved about 9,400 operations/s (106 µs of elapsed benchmark time per completed operation); inherited checks achieved about 7,200 operations/s (140 µs/op). These are aggregate throughput measurements, not individual request latencies. Only this concurrency level was measured; they do not establish saturation capacity or linear scaling with more connections.

Caching

The optional in-memory cache answers repeated checks without a database call:

ScenarioLatency
Uncached check616 µs
First check for a key (cache miss)582 µs
Cached check117 ns
Bulk check, all cached68 to 84 µs
cache := melange.NewCache(
    melange.WithTTL(time.Minute),
)
checker := melange.NewChecker(db, melange.WithCache(cache))

Use caching when permissions are read much more often than they change and a staleness window (typically 30 seconds to 5 minutes) is acceptable. Skip it when permissions change frequently or you need every check to see the latest writes. See Caching.

Invalid requests

The Go checker rejects invalid relations, types, and subject formats before sending anything to the database, so they cost no round trip.

List operations

list_accessible_objects and list_accessible_subjects return every match, so their cost depends on how much of the permission graph Postgres has to walk to find them. That is not always the size of the answer:

  • Candidates, not results. An intersection enumerates candidates from a part and filters them; an exclusion starts from its base relation. viewer and active over a document set costs about the same as listing every viewer, even when only a few documents pass the active filter.
  • Graph size, not results. Recursive relations (viewer from parent) and userset subjects (group:eng#member through nested groups) walk the reachable graph. A query that returns 10 results can still take hundreds of milliseconds if those results are found through thousands of group memberships.
  • Pagination may bound the response without reducing the expensive work. The first PR page took 262 to 269 ms at the largest hierarchy scale for limits of 10, 50, 100, and 500. Later-page costs were not measured. Inspect your plan before assuming a smaller limit makes it faster.

ListObjects

Measured end to end. Each cell shows fixture-derived result cardinality, then measured latency. The benchmark output records timings, not row counts. Scale labels refer to two different datasets; see Benchmark models. The PR row uses a paginated first-page call: its count is the accessible universe, not the page payload.

Query shape1K label10K label100K label1M label
Few results, short paths (organizations a user belongs to, groups a service account is in)1 to 2: 0.46 to 0.50 ms1 to 2: 0.51 to 0.55 ms1: 0.43 to 0.53 ms1: 0.45 to 0.99 ms
Objects inherited through one parent (pull requests readable via repository → organization)100: 2.8 ms1,000: 7.5 ms5,000: 39 ms20,000: 266 ms
Union of direct, group, folder-inherited, and public grants36: 6.1 ms380: 20 ms2,580: 68 ms13,020: 339 ms
Intersection over that union (viewer and active)12: 5.8 ms20: 15 ms30: 43 ms42: 211 ms
Recursive folders (viewer from parent, depth 4 to 7)12: 2.1 ms20: 6.1 ms30: 9.8 ms42: 32 ms
Userset subject through nested groups (40 to 2,000 groups)3: 1.6 ms5: 6.3 ms8: 30 ms10: 188 ms

Do not extrapolate a universal cost per returned object from these rows. At the largest kitchen-sink scale, DocCanView spent 336.1 ms of 339.1 ms in PostgreSQL; DocGated spent 210.2 ms of 211.0 ms there despite its much smaller result. Reducing round-trip latency alone would barely change either total. Profile candidate enumeration, joins, and recursive expansion.

ListSubjects

Query shape1K label10K label100K label1M label
One subject (intersections such as viewer and active, folder editors)1: 0.90 to 0.95 ms1: 0.89 to 0.99 ms1: 0.93 to 0.94 ms1: 0.72 to 0.86 ms
Direct members of an organization20: 0.62 to 0.67 ms50: 0.67 to 0.72 ms100: 0.64 to 0.79 ms200: 0.76 to 1.07 ms
Readers inherited from the parent organization20: 0.97 to 1.03 ms50: 1.4 to 1.5 ms100: 2.0 to 2.3 ms200: 5.6 to 6.1 ms
Viewers of a folder, through parent folders15: 2.8 ms32: 5.0 ms68: 8.0 ms168: 9.5 ms
Viewers of a document, through nested groups and folders16: 11 ms33: 22 ms69: 44 ms169: 106 ms
Same, with an exclusion that removes every subject (viewer but not blocked)0: 20 ms0: 40 ms0: 81 ms0: 220 ms

The last row returns nothing and still costs the most: the exclusion has to find every viewer before it can remove them.

Where large list queries spend their time

At the 1M kitchen-sink label (840,877 tuples), the expensive lists are dominated by PostgreSQL. These are selected full-result SQL calls; the paginated PR benchmarks do not record this split.

Direction / relationTotalIn databaseNetwork and client
Objects: document can_view (union + exclusion)339.1 ms336.1 ms3.1 ms
Objects: document gated (intersection)211.0 ms210.2 ms0.816 ms
Objects: organization member, userset subject188.0 ms187.2 ms0.783 ms
Objects: document can_edit (intersection)51.9 ms51.1 ms0.776 ms
Objects: folder viewer (recursive TTU)31.7 ms31.0 ms0.683 ms
Subjects: document can_view (exclusion)219.6 ms218.9 ms0.752 ms
Subjects: document viewer (union + inherited grants)106.1 ms105.4 ms0.702 ms
Subjects: document gated (intersection)0.861 ms0.463 ms0.398 ms

Schema shape

The same relation can behave very differently in the two listing directions. Use this map when interpreting the measurements:

FeatureWhat to inspectEvidence in this run
Direct / computed userset / unionIndex lookups, number of grants, duplicate pathsSmall fixtures generally below 0.6 ms; a broad document union plus exclusion reaches 339 ms for object listing.
TTU (viewer from parent)Parent count, join selectivity, inherited candidatesPR first pages reach 262–269 ms; a page limit does not remove the inherited-access work in this fixture.
Recursive TTUDepth, branching, overlap in reachable ancestorsFolder viewer object lists: 2.1–31.7 ms; subject lists: 2.8–9.5 ms.
Userset references (group#member)Nested membership expansion; querying a userset versus querying a userUserset-subject organization lists: 1.6–188 ms, versus 0.420–0.501 ms for the corresponding point checks.
IntersectionCandidate part size and selectivity of the other partsDocument gated object lists: 5.8–211 ms; subject lists: 0.861–0.993 ms.
ExclusionSize of base relation and cost of subtracting grantsDocument can_view subject lists: 20.1–219.6 ms even though this selected document’s wildcard block removes all subjects.
WildcardBoolean membership versus expansion into objects or subjectsNamed wildcard fixture object lists range from 0.451 to 21.8 ms.

Do not replace and with or as a performance optimization: that changes who has access. Keep the required semantics and optimize indexes, candidate selection, data layout, or the API used by the application.

OpenFGA test suite

The OpenFGA compatibility suite covers every supported feature on small datasets. Each assertion runs as its own benchmark, 2,032 in all:

OperationBenchmarksMedian of mediansp90 of mediansMedian database share
Check8890.60 ms0.76 ms24%
BulkCheck1940.83 ms1.4 ms38%
ListObjects5560.90 ms2.2 ms43%
ListUsers3930.79 ms1.4 ms41%

These are Melange timings while executing OpenFGA compatibility fixtures, not measurements of an OpenFGA server. Percentiles summarize equally weighted assertion benchmarks after taking each one’s six-run median. They do not describe production traffic or request p90. A fixture can combine several features, so a single pooled “intersection latency” would hide both operation direction and workload differences.

Feature examples on small fixtures

Each cell is the range of six-run medians across assertions of that operation in the named fixture, in milliseconds. Check includes allowed and denied assertions. The examples are useful for comparing query shapes, but are not controlled experiments isolating the cost of one feature. ListUsers is the compatibility-suite name for listing subjects.

FeatureFixtureCheck (ms)ListObjects (ms)ListUsers (ms)
Direct [user]this0.450–0.4570.475–0.5240.488–0.532
Computed userset / relation aliascomputed_userset0.404–0.4270.459–0.4690.427–0.480
Union (or)this_and_union0.410–0.4180.434–0.4740.469–0.481
Tuple-to-userset (from)tuple_to_userset0.4430.4990.364–0.529
Intersection (and)this_and_intersection0.403–0.4300.763–0.8040.623
Exclusion (but not)this_and_exclusion_base0.361–0.4150.418–0.5280.467–0.477
Wildcard expansionlist_objects_expands_wildcard_tuple1.2–2.50.451–21.80.486–14.4

The wildcard fixture has both cheap and expensive assertions: the expensive object lists spend 96–97% in PostgreSQL. A wildcard grant can be cheap to check while enumeration is expensive. It is not a uniformly cheap feature.

For nested usersets and recursive TTU at scale, use the kitchen-sink tables above: folder viewer lists rise from 2.1 to 31.7 ms, and listing organization membership for a userset subject rises from 1.6 to 188 ms. Those queries also change graph size and fan-out; they do not measure a fixed per-hop penalty.

Contextual tuples

Contextual tuples are made visible by creating a temporary view for the call and dropping it afterwards. On Cloud SQL a check with contextual tuples took:

Contextual tuplesLatency
None (same connection handling)0.44 ms
17.4 ms
258.1 ms
10010.1 ms

List queries with contextual tuples in the OpenFGA suite took 7 to 11 ms. The strategy timings include connection handling, temporary-view DDL, the permission query, and cleanup; they do not provide a server/client split. Some contextual compatibility cases also require multiple statements, so the one-statement check model does not apply. Keep contextual tuples off hot paths, and model data in your tables where you can.

Methodology

DatabaseCloud SQL for PostgreSQL 17.11, Enterprise edition, 4 vCPU, 16 GB (db-custom-4-16384), zonal, SSD
ClientCompute Engine n2d-standard-4 (4 vCPU, AMD EPYC 7B13), Go, pgx through database/sql
NetworkSame zone (europe-west2-a), private IP, SSL
MelangeSource marker 49f41f35, plus any uncommitted changes present at upload; the report does not identify that patch
RunsEach benchmark run 6 times; the page shows medians, or the range of medians across dataset sizes
DateOctober 20 to 21, 2026 (20:12 to 00:24 UTC)

Datasets. See the complete schemas and fixture configuration in Benchmark models. Two generated datasets, each at four sizes:

  • A schema that uses every relation feature: nested groups, recursive folders, organizations, intersections, exclusions, and wildcards. 3,824, 25,386, 155,692, and 840,877 tuples. Measured by calling the generated SQL functions directly.
  • An organization → repository → pull request hierarchy. 1,150, 21,000, 204,000, and 2,020,000 tuples. Measured through the Go Checker. The bulk, concurrency, and cache numbers, and the list rows that mention organizations, repositories, or pull requests, use this dataset; concurrency and caching use the 21,000-tuple size.

The OpenFGA suite uses each test’s own small fixture, through the Go Checker (bulk checks call check_permission_bulk directly).

The downloadable measurement snapshot preserves six-run medians for the scale, cache, concurrency, contextual-strategy, and named feature examples on this page, with units and sample counts. It was extracted from the raw benchmark output in benchmarks/2026-10-cloud-sql/, which also has the database and network split for every kitchen-sink and OpenFGA benchmark. Blank database metrics mean that benchmark did not record a split.

Six-run spreads reach about 25% for some kitchen-sink cases and 44% for one expensive wildcard object list. These are repeated benchmark averages, not individual request samples. There is no production p95/p99, cold-cache study, saturation test, or before/after baseline here. Independently calculated column medians need not add up exactly.

End to end is the time the client measured for one call, including the network round trip and driver work. In database is the execution time plus any tracked planning time for the statements the call sent, from pg_stat_statements. Planning time is included only if pg_stat_statements.track_planning is enabled; the saved run does not record that setting. Network and client is the difference.

What will differ for you. Your round-trip time sets the floor for every call: a cross-zone or cross-region connection adds its latency to each one. Database time depends on your schema, your data’s shape, the indexes on your tuple source tables, and the instance size. Compare runs on the same setup; local Docker timings are not directly comparable to these cloud measurements.

Run the same benchmarks on your own Google Cloud project with just bench-cloud, or locally; see Benchmarking.

Further reading

  • Benchmarking: run these benchmarks yourself.
  • Scaling: indexing and view strategies for large datasets.
  • How It Works: the architecture behind these characteristics.