Skip to content

Read side of the index recommendation: UNIQUE, UNIQUE_HASH, NOTUNIQUE, or none #357

Open

Description

@tae898

Problem

I want the read-side cost of each index type, before and after a load, to complete the index recommendation that today rests on the write side.

It is one row of the bindings study list. It was held on stale pins and re-pins after the 26.12.1 wheels exist.

Priority: P3 (not on any deadline).

Acceptance

  • The dry run is clean and its report is written
  • The study runs and is scored
  • The index recommendation in the docs covers reads as well as writes

Results and the scorer output go in this issue as comments. Numbers are generated by script from the result files, never typed.

(Edited 2026-11-24: the study now measures on the 26.12.1 wheels, see #315.)

Activity

  1. added
    python
    performance
    on Nov 10, 2026
  2. added this to the 26.12.1 milestone on Nov 10, 2026
  3. modified the milestones: 26.12.1, 27.1.1 on Nov 21, 2026
  4. added
    enhancement
    on Dec 2, 2026
  5. tae898 commented on Dec 5, 2026

    @tae898
    CollaboratorAuthor

    Read-side result on 26.12.1.dev2: on the native wheel any index makes a read by key over 1,000 times faster, the JVM wheel is only partly decided, and I queued a second run

    Here is the read-side result for this issue. It ran on 26.12.1.dev2 of arcadedb (native) and arcadedb-jvm (the final 26.12.1 is not on PyPI yet), on one laptop with two pinned cores, 500,000 rows and 7 rounds. I will repeat it on the final wheels. All 224 cells ran and every answer was checked, so none failed. Nothing is asked of you here.

    What I observed on the native wheel (all 48 figure rows have a verdict, the control held, and int and str keys behave alike):

    • A point read by key (hit or miss) takes 13.0 to 47.2 µs with any of the three index kinds, built before or after the load. With no index it takes 53 to 63 ms. Every one of these rows is FASTER, about 1,300 to 4,800 times faster (ratio 0.00021 to 0.00076 of the no-index time).
    • A range of 100 keys takes 230 to 456 µs with NOTUNIQUE or UNIQUE (the LSM tree), against 80 to 93 ms with no index. UNIQUE_HASH brings it only to 0.91 to 0.93 of the no-index time, so I read it as a scan: a hash index does not serve a range.
    • ORDER BY k LIMIT 100 is not helped by any index. NOTUNIQUE and UNIQUE are SLOWER than no index (ratio 1.4 to 1.5), UNIQUE_HASH is SAME. I have not looked into why.
    • Before or after the load: the medians differ by up to 23 µs on a point hit and 153 µs on a range, and the direction depends on the kind (NOTUNIQUE is slower when built after the load, UNIQUE is faster, UNIQUE_HASH is unchanged). The study's rules compare each cell with no index only, so they do not say whether before or after is better, and I do not call one (build and load costs are the write side, Bulk-load table: UNIQUE or UNIQUE_HASH before against after the load, per wheel #362).

    Recommendation for the native wheel, int and str keys: for reads, use an LSM index, UNIQUE when the key is unique and NOTUNIQUE when it repeats, built before or after the load, if the key is read by equality and by range. UNIQUE_HASH is enough when the key is only read by equality (its medians for a point hit are 17.7 to 18.2 µs, against 19.8 to 47.2 µs for the LSM kinds), and it does not help a range. No index helps ORDER BY k LIMIT 100 here. The study does not rank the index kinds against each other, so the gap between hash and LSM on a point hit is a number to read, not a verdict.

    JVM wheel: I cannot give a full recommendation. Of its 48 figure rows, 15 have a verdict, 15 are WEAK and 18 are INVALID(control).

    • The A/A control (UNIQUE before the load, run twice) drifted outside 1.00 +/- 0.05 for three of the eight JVM figure and key combinations: point hit int (0.94), range of 100 int (0.93), point miss str (0.94). The rule says INVALID reports no result, so I draw none from those rows (for int that is every point hit and every range row, for str every point miss row).
    • For point reads and ranges, the 12 JVM rows that have a verdict point the same way as native: FASTER with an index (int point miss, 5 of 6 configurations; str point hit with UNIQUE built before or after the load and UNIQUE_HASH built after it; str range of 100 with NOTUNIQUE and UNIQUE built after it), and UNIQUE_HASH on a range of 100 is SAME on str (native reads 0.91 to 0.93 there, which the rule calls FASTER, so on both wheels a hash index does not serve a range).
    • ORDER BY k LIMIT 100 is WEAK in 9 of the 12 JVM rows with an index (in some cells the highest and lowest round differ by about as much as the median), and the other 3 are SLOWER: int with UNIQUE built before or after the load and with UNIQUE_HASH built before it (native has UNIQUE_HASH as SAME here, so this one differs). I say nothing more about it.

    I queued a second full run of the same kit as main-r2 (the same smoke passed for this kit, nothing changed in it, no round is added to the first run). I will post it as its own result and will not pool it with this one.

    Count of figure rows by verdict (4 figures x 6 index configurations per wheel and key type, the no-index rows are the baseline and not counted):

    wheel key FASTER SAME SLOWER WEAK INVALID(control)
    native int 18 2 4 0 0
    native str 18 2 4 0 0
    jvm int 5 0 3 4 12
    jvm str 5 2 0 11 6

    Native wheel, median time per call in µs (the verdict of every row is in the details below; the point miss rows follow the point hit rows closely):

    index point hit int point hit str range of 100 int range of 100 str order by limit 100 int order by limit 100 str
    none 52,708 62,678 80,366 92,590 66,003 78,204
    NOTUNIQUE, before load 25.9 23.8 263 303 101,861 108,670
    NOTUNIQUE, after load 35.6 47.2 301 456 101,752 109,114
    UNIQUE, before load 25.5 23.0 259 306 100,119 109,525
    UNIQUE, after load 20.0 19.8 230 249 102,209 108,930
    UNIQUE_HASH, before load 17.7 18.1 73,942 84,959 65,648 78,010
    UNIQUE_HASH, after load 17.8 18.2 73,839 85,196 65,794 78,320

    Lane and heat. The Worker recorded no job beside it (host_co_runners is empty, nothing halted it) and the queue history shows no other queued job on the other laptop lane while it ran (a job outside the queue would show only as the foreign process tree below). A foreign process tree showed up on the two cores in 2 of 315 samples, at most 0.24 of a core. The laptop did heat: the package reached 98 C, 47 of 315 samples were at 94 C or more, and the Worker's throttle counter shows 62.2 s over the 1940 s sampled (3.2%). I did not map the throttling to single cells. The native rows have tight intervals and a clean control, so I take them as they are. For the JVM wheel I cannot say how much of its spread is heat and how much is the JVM itself (its control ratios range from 0.74 to 1.53 between single rounds).

    Method, verdict rules and limits

    The rules were written before the first timed run and not changed after it.

    • Cells: wheel (arcadedb native, arcadedb-jvm) x key type (int, str) x index (none, then NOTUNIQUE, UNIQUE and UNIQUE_HASH, each built before or after the load), plus a control that repeats UNIQUE before the load. One fresh process per cell, 500,000 rows loaded with insert_many in shuffled key order, heap 1 GB on both wheels, two pinned cores of a laptop compare lane (Python 3.12, engine 26.12.1-SNAPSHOT build 4a91847a). 7 rounds, the cell order shuffled in every round.
    • Figures: median time per call in µs of the same SQL text with to_list(): point hit (WHERE k = ?, 2,000 calls, 20 without an index), point miss (same), range of 100 keys (k >= ? AND k < ?, 500 calls where an ordered index can serve it, else 20) and ORDER BY k LIMIT 100 (20 calls).
    • Validity of a cell: every answer is checked (one row with the key, no row for a miss, 100 rows for a range, 100 sorted rows from the smallest key), the stored row count and the index type and uniqueness must be the asked ones, and the backend must be the asked one. No cell failed.
    • Verdict per figure: the ratio to the no-index cell of the same round, median over rounds, with a 95% bootstrap interval (10,000 resamples, seed 1). INVALID(control) when the control's median ratio (second run of one cell over the first) is outside 1.00 +/- 0.05. WEAK when there are fewer than 3 pairs or the interval is wider than 0.20 of the median. Otherwise FASTER (upper end below 0.95), SLOWER (lower end above 1.05) or SAME. INVALID and WEAK report no result. The control is judged per wheel, key type and figure, so one figure can be INVALID while the others of the same wheel and key stand.
    • Control ratios (median over 7 rounds, with the lowest and highest single round): native 0.989 to 1.015 (all eight within 1.00 +/- 0.05); JVM int order_limit100 1.023 (0.92 to 1.08); int point_hit 0.942 (0.80 to 1.26) OUT; int point_miss 0.997 (0.82 to 1.01); int range100 0.928 (0.88 to 1.19) OUT; str order_limit100 0.989 (0.89 to 1.04); str point_hit 0.992 (0.74 to 1.12); str point_miss 0.945 (0.91 to 1.05) OUT; str range100 1.023 (0.74 to 1.53).
    • A rehearsal of the same kit at 3,000 rows on 26.11.1.post4 passed before this run. It is never read as a result.
    • Limits: one host, one key column, 500,000 rows, one thread, a warm process, default engine settings. Not measured: other row counts, composite keys, null keys, concurrent writers. Load time, index build time, database size and peak memory were recorded and are not part of the read question.
    All rows, native wheel, int key

    Each cell: median µs, ratio to no index [95% interval], verdict. The no-index row has ratio 1 by definition.

    index point hit point miss range of 100 order by limit 100
    none 52,708 µs 52,572 µs 80,366 µs 66,003 µs
    NOTUNIQUE, before load 25.9 µs, 0.000494 [0.000483, 0.00051], FASTER 14.9 µs, 0.000282 [0.000278, 0.000286], FASTER 263 µs, 0.00327 [0.0032, 0.00342], FASTER 101,861 µs, 1.55 [1.53, 1.59], SLOWER
    NOTUNIQUE, after load 35.6 µs, 0.000685 [0.000659, 0.000696], FASTER 16.6 µs, 0.000314 [0.000308, 0.00032], FASTER 301 µs, 0.00375 [0.00365, 0.00382], FASTER 101,752 µs, 1.54 [1.52, 1.56], SLOWER
    UNIQUE, before load 25.5 µs, 0.000486 [0.00048, 0.000491], FASTER 14.7 µs, 0.000278 [0.000269, 0.000286], FASTER 259 µs, 0.00327 [0.00313, 0.0033], FASTER 100,119 µs, 1.52 [1.51, 1.56], SLOWER
    UNIQUE, after load 20.0 µs, 0.000382 [0.000378, 0.000385], FASTER 13.3 µs, 0.000254 [0.000248, 0.000255], FASTER 230 µs, 0.00288 [0.00281, 0.00292], FASTER 102,209 µs, 1.54 [1.54, 1.57], SLOWER
    UNIQUE_HASH, before load 17.7 µs, 0.000336 [0.000333, 0.00034], FASTER 13.7 µs, 0.00026 [0.000252, 0.000266], FASTER 73,942 µs, 0.912 [0.9, 0.93], FASTER 65,648 µs, 0.996 [0.979, 0.999], SAME
    UNIQUE_HASH, after load 17.8 µs, 0.000339 [0.000337, 0.000343], FASTER 13.9 µs, 0.000264 [0.000261, 0.000268], FASTER 73,839 µs, 0.919 [0.885, 0.931], FASTER 65,794 µs, 0.996 [0.987, 0.998], SAME
    All rows, native wheel, str key

    Each cell: median µs, ratio to no index [95% interval], verdict. The no-index row has ratio 1 by definition.

    index point hit point miss range of 100 order by limit 100
    none 62,678 µs 62,564 µs 92,590 µs 78,204 µs
    NOTUNIQUE, before load 23.8 µs, 0.000381 [0.000376, 0.00039], FASTER 14.8 µs, 0.000237 [0.000236, 0.000237], FASTER 303 µs, 0.00329 [0.00325, 0.0033], FASTER 108,670 µs, 1.39 [1.38, 1.4], SLOWER
    NOTUNIQUE, after load 47.2 µs, 0.000759 [0.00073, 0.000804], FASTER 18.3 µs, 0.000292 [0.000289, 0.000294], FASTER 456 µs, 0.00493 [0.00484, 0.00509], FASTER 109,114 µs, 1.4 [1.38, 1.4], SLOWER
    UNIQUE, before load 23.0 µs, 0.000366 [0.000359, 0.000386], FASTER 14.8 µs, 0.000238 [0.000236, 0.00024], FASTER 306 µs, 0.0033 [0.00327, 0.00333], FASTER 109,525 µs, 1.4 [1.4, 1.41], SLOWER
    UNIQUE, after load 19.8 µs, 0.000315 [0.000312, 0.000316], FASTER 13.0 µs, 0.000208 [0.000206, 0.00021], FASTER 249 µs, 0.00268 [0.00267, 0.00271], FASTER 108,930 µs, 1.39 [1.38, 1.4], SLOWER
    UNIQUE_HASH, before load 18.1 µs, 0.000289 [0.000286, 0.000291], FASTER 14.1 µs, 0.000227 [0.000225, 0.000228], FASTER 84,959 µs, 0.911 [0.91, 0.938], FASTER 78,010 µs, 0.998 [0.996, 1], SAME
    UNIQUE_HASH, after load 18.2 µs, 0.000292 [0.00029, 0.000293], FASTER 14.4 µs, 0.000232 [0.000227, 0.000233], FASTER 85,196 µs, 0.925 [0.909, 0.93], FASTER 78,320 µs, 1 [0.996, 1.03], SAME
    All rows, jvm wheel, int key

    Each cell: median µs, ratio to no index [95% interval], verdict. The no-index row has ratio 1 by definition.

    index point hit point miss range of 100 order by limit 100
    none 27,276 µs 26,306 µs 42,852 µs 41,816 µs
    NOTUNIQUE, before load 90.4 µs, 0.00346 [0.003, 0.00352], INVALID(control) 28.4 µs, 0.00111 [0.000954, 0.00122], WEAK 586 µs, 0.0137 [0.0108, 0.015], INVALID(control) 54,839 µs, 1.34 [1.16, 1.43], WEAK
    NOTUNIQUE, after load 96.9 µs, 0.00354 [0.00325, 0.00364], INVALID(control) 31.6 µs, 0.00115 [0.00101, 0.00123], FASTER 594 µs, 0.0133 [0.0132, 0.0142], INVALID(control) 58,683 µs, 1.38 [1.31, 1.59], WEAK
    UNIQUE, before load 85.1 µs, 0.00309 [0.0028, 0.00338], INVALID(control) 26.9 µs, 0.00105 [0.000947, 0.00107], FASTER 615 µs, 0.0142 [0.014, 0.015], INVALID(control) 55,521 µs, 1.29 [1.23, 1.41], SLOWER
    UNIQUE, after load 89.4 µs, 0.00333 [0.00293, 0.00336], INVALID(control) 27.6 µs, 0.00104 [0.000954, 0.00105], FASTER 560 µs, 0.0133 [0.0131, 0.0136], INVALID(control) 57,357 µs, 1.38 [1.32, 1.49], SLOWER
    UNIQUE_HASH, before load 63.0 µs, 0.00225 [0.00216, 0.00236], INVALID(control) 26.1 µs, 0.001 [0.000919, 0.00103], FASTER 40,707 µs, 0.948 [0.904, 0.982], INVALID(control) 48,115 µs, 1.2 [1.17, 1.32], SLOWER
    UNIQUE_HASH, after load 80.7 µs, 0.00284 [0.0023, 0.00338], INVALID(control) 26.1 µs, 0.000991 [0.000908, 0.00104], FASTER 41,316 µs, 0.978 [0.929, 0.989], INVALID(control) 49,312 µs, 1.19 [1.06, 1.34], WEAK
    All rows, jvm wheel, str key

    Each cell: median µs, ratio to no index [95% interval], verdict. The no-index row has ratio 1 by definition.

    index point hit point miss range of 100 order by limit 100
    none 32,893 µs 31,874 µs 45,285 µs 64,259 µs
    NOTUNIQUE, before load 76.7 µs, 0.00233 [0.00209, 0.00266], WEAK 27.8 µs, 0.000872 [0.000815, 0.000957], INVALID(control) 549 µs, 0.0113 [0.0109, 0.0137], WEAK 58,450 µs, 0.925 [0.545, 1.15], WEAK
    NOTUNIQUE, after load 98.5 µs, 0.00313 [0.00299, 0.00374], WEAK 28.6 µs, 0.000895 [0.000873, 0.00106], INVALID(control) 648 µs, 0.0136 [0.0132, 0.0143], FASTER 64,362 µs, 0.928 [0.538, 1.29], WEAK
    UNIQUE, before load 79.0 µs, 0.00235 [0.00223, 0.00259], FASTER 26.5 µs, 0.000817 [0.000784, 0.000832], INVALID(control) 471 µs, 0.0102 [0.0097, 0.0143], WEAK 60,072 µs, 0.912 [0.564, 1.13], WEAK
    UNIQUE, after load 79.8 µs, 0.00239 [0.00239, 0.00248], FASTER 25.7 µs, 0.00081 [0.000788, 0.000851], INVALID(control) 573 µs, 0.0125 [0.0121, 0.0135], FASTER 60,407 µs, 0.952 [0.539, 1.16], WEAK
    UNIQUE_HASH, before load 71.7 µs, 0.00201 [0.00187, 0.0025], WEAK 25.2 µs, 0.000818 [0.000782, 0.000855], INVALID(control) 46,468 µs, 1.03 [0.961, 1.05], SAME 53,988 µs, 0.812 [0.679, 1.03], WEAK
    UNIQUE_HASH, after load 59.3 µs, 0.00186 [0.00162, 0.00195], FASTER 25.7 µs, 0.00082 [0.000785, 0.000843], INVALID(control) 48,827 µs, 1.07 [1.01, 1.09], SAME 64,026 µs, 1.04 [0.474, 1.33], WEAK
  6. tae898 commented on Dec 6, 2026

    @tae898
    CollaboratorAuthor

    Second full run of the read-side study on 26.12.1.dev2 (main-r2): the native result of the first run holds, and the JVM wheel stays undecided

    This is the repeat I queued after the first run above. It is the same kit (checksum b456c1cf...), the same wheels (arcadedb and arcadedb-jvm 26.12.1.dev2), 500,000 rows and 7 rounds, and I report it as its own run. I do not pool it with the first run. All 224 cells ran and every answer was checked. Nothing is asked of you here.

    What I observed

    • Native: all 48 figure rows have the same verdict as in the first run, and the A/A control (UNIQUE before the load, run twice) is inside 1.00 +/- 0.05 for all 8 figure and key combinations (0.986 to 1.004). So the native recommendation above stands without change.
    • JVM: the A/A control is outside the band in 6 of 8 figure and key combinations in this run, against 3 of 8 in the first run. A row of an INVALID control reports no result, so I draw no JVM conclusion from those rows. 14 of 48 JVM figure rows have the same verdict as in the first run and 34 have another one.
    • Not established: why the JVM controls drift further in this run. I did not test it, so I do not name a cause.

    Count of figure rows by verdict (4 figures x 6 index configurations per wheel and key type, the no-index rows are the baseline and not counted)

    run wheel key FASTER SAME SLOWER WEAK INVALID(control)
    first (main) native str 18 2 4 0 0
    first (main) native int 18 2 4 0 0
    first (main) jvm str 5 2 0 11 6
    first (main) jvm int 5 0 3 4 12
    second (main-r2) native str 18 2 4 0 0
    second (main-r2) native int 18 2 4 0 0
    second (main-r2) jvm str 6 0 0 0 18
    second (main-r2) jvm int 0 0 1 5 18

    If the 8 no-index baseline rows of the JVM wheel are counted too, it has 21 INVALID(control) and 15 WEAK rows in the first run, and 42 INVALID(control) and 5 WEAK rows in the second.

    A/A control per wheel, key and figure (median over 7 rounds of the second run over the first run of the same cell; inside 1.00 +/- 0.05 is valid)

    wheel key figure first run valid second run valid
    native int point hit 0.989 yes 0.986 yes
    native int point miss 1.009 yes 0.998 yes
    native int range of 100 1.015 yes 0.994 yes
    native int ORDER BY LIMIT 100 0.999 yes 1.003 yes
    native str point hit 0.995 yes 1.004 yes
    native str point miss 0.994 yes 0.992 yes
    native str range of 100 0.996 yes 1.003 yes
    native str ORDER BY LIMIT 100 0.998 yes 0.998 yes
    jvm int point hit 0.942 no 0.921 no
    jvm int point miss 0.997 yes 1.050 no
    jvm int range of 100 0.928 no 0.907 no
    jvm int ORDER BY LIMIT 100 1.023 yes 1.026 yes
    jvm str point hit 0.992 yes 1.054 no
    jvm str point miss 0.945 no 1.025 yes
    jvm str range of 100 1.023 yes 1.067 no
    jvm str ORDER BY LIMIT 100 0.989 yes 1.051 no

    Lane and heat. This run was on compare1 (cores 6-7), the first on compare2 (cores 10-11). During this run the other compare lane was busy: the Worker recorded main-n1 of the vector-wheels study on it for 1913 of the 1916 s sampled (host_lane_mode is beside). The rules of this study drop no cell for a busy neighbour lane, so none was dropped for it. The A/A control above is what tells whether the neighbour mattered, and it held for every native combination. A foreign process tree was on the two cores in 0 of 377 samples (at most 0.006 of a core). The package reached 88 C at most and the throttle counter read 0.0 s. In the first run it reached 98 C and 62.2 s (3.2% of the window).

    Limit that applies to both runs. The 26.12.1.dev2 wheels were uploaded to PyPI on 2026-11-07 from bindings commit 4b8a5b1, and main is 225 commits ahead of it (checked on 2026-12-06). These figures are for that code, so I still repeat the study on the final 26.12.1 wheels as a new run.

  7. tae898 commented on Dec 6, 2026

    @tae898
    CollaboratorAuthor

    A short follow-up to my limit comment above. These figures describe the 26.12.1.dev2 wheels of 2026-11-07, built from bindings commit 4b8a5b1, and not what 26.12.1 will ship. main is 225 commits ahead of it (checked again on 2026-12-06). The wheels lack, for example, #320 (the exact double for a FLOAT or float32 array in to_json_list on the JVM wheel), #392 (insert_many on the JVM wheel sends homogeneous chunks as typed columns, not as JSON text) and #391 (the same for GraphBatch.create_vertices and new_edges); all three were merged after 4b8a5b1. Judging by their titles these three change other paths than reading by key, so I do not expect them to move the read-side figures; the other 222 commits I have not checked against them.

    State: both full runs (main and main-r2) are finished and reported above, and nothing is queued. Next: once the final 26.12.1 wheels are on PyPI (there is only 26.12.1.dev2 so far), I will re-pin the kit to them as a new kit (only its wheel pins change) and rerun what matters. The dev2 figures stay here as the pre-release baseline, and the result on the final wheels comes as its own comment.

  8. added
    jvm
    native
    on Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementjvmnativeperformancepython

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions