This doesn't feel like the same thing. The performance benefits of an RDBMS come from the way its storage is organized and (at least in typical RDBMS scenarios) the way queries are dynamically optimized to traverse that storage, based on the data it contains.
The thing rustc calls "queries" is more about incremental compilation- reusing work within and across compiler invocations, but without the sort of impact on memory layout and access patterns that you get from an RDBMS.
The closest thing I've seen in a compiler is rather Zig's AST memory layout work: https://github.com/ziglang/zig/pull/7920. But this is a very "hand-crafted" version of what an RDBMS does.
The thing rustc calls "queries" is more about incremental compilation- reusing work within and across compiler invocations, but without the sort of impact on memory layout and access patterns that you get from an RDBMS.
The closest thing I've seen in a compiler is rather Zig's AST memory layout work: https://github.com/ziglang/zig/pull/7920. But this is a very "hand-crafted" version of what an RDBMS does.