Release 0.5.2
A patch release of the 0.5 line. Three fixes come from a benchmark against another in-memory
graph database on graphs of up to 5 million vertices and 10 million edges: whole-pattern counts
in GQL, membership tests against side effects, and the spare memory a graph built by write
queries keeps. The release also adds the GQL operator =~ and gives every note of the command
line tool one readable layout. It changes no format; stores, snapshots and journals of 0.5.0 and
0.5.1 are read and written exactly as before. The new API items are additive.
Added
shrink_to_fit()releases the spare capacity of a graph built by write queries (#22). A graph grows its vertex and edge slots by doubling; after a bulk load by queries up to half of them can stay unused (on 5M vertices and 10M edges built with GQLCREATE: 1.24 GB of 5.0 GB). Every load of a file already ended compact; now a graph in memory can be made compact too:g.shrink_to_fit()in the DSL,graph.shrink_to_fit()in Python,Graph::shrink_to_fit()/AnyGraph::shrink_to_fit()in Rust (ShrinkReportin thestoragemodule). It reports the memory before and after, writes no commit and keeps every handle valid; call it once after a bulk load, not after every batch. It asks forUpdateon the data (Permissions), so a read-only policy refuses it (Memory Inspection and Profiling).- GQL: the regular-expression match
s =~ pattern, Cypher's operator as a compatibility form: it matches the whole string, in the dialect of the Rustregexcrate; a NULL or non-string operand gives NULL, an invalid literal pattern is refused before the query runs, andn.key =~ 'literal'is answered withhas(key, TextP.regex(..))(GQL aliases).
Changed
- GQL counts over a whole pattern are answered from the statistics
(#20).
MATCH (n) RETURN count(n),MATCH (n:Label) ...,MATCH ()-[r]->() RETURN count(r),MATCH ()-[r:TYPE]->() ...and theircount(*)forms now get the plans ofg.v().count()/g.e().count(): on 10M edges the edge count takes 0.03 ms instead of 1.3 s, and it no longer fails the default 1 GiB per-query memory limit. Every othercount(x)of a variable that can never be NULL no longer records the variable for each row, so counts over larger patterns need less memory. Results do not change (GQL plans). An edge count now reads edges only, asg.e().count()does: a policy that denies reading vertices but allows edges allows it. within/withoutagainst a side effect or a long list are hash lookups (#21).where(P.without("x"))against anaggregate("x")orstore("x")of 16 or more members, andhas/is/has_valuewith a literalwithin/withoutlist of 16 or more values, no longer compare against every member for every traverser. The usual breadth-first search with a visited set,aggregate("x").repeat(__.both().where(P.without("x")).aggregate("x")), was quadratic: on 100 000 vertices and 1M edges it now takes 0.7 s, where 0.5.1 did not finish in 10 minutes. The comparison itself is unchanged (a hash only proposes candidates), so results do not change; one edge case: when reading a member fails, its error now surfaces only if no other member matches.- Every note of the command line tool has one layout (#19): the notes of an upgrade, a
.gsnapload, a model import, the store refusals, thestore,embed-modeland start outputs, the error helps that name commands and the journal's recommendations are a short headline, one indentedkey: valueper line and each shell command on a line of its own under a# comment.graphersal store models,store attic listandembed-model listshow one section per entry.
Fixed
graphersal store infocounts the blobs in use and the unused ones apart; before, the row read as if a model's blob were about to be removed by the next prune (#19).
Upgrading from 0.5.1
A drop-in replacement: no format change, no upgrade step, only additive API. Stores, snapshots, journals and backups of 0.5.0, 0.5.1 and 0.5.2 are interchangeable.