cruppstahl / upscaledb

A very fast lightweight embedded database engine with a built-in query language.
https://upscaledb.com
Apache License 2.0
569 stars 71 forks source link

how to join tables? #116

Closed 0x410c closed 6 years ago

0x410c commented 6 years ago

i want to join two tables to find all matchin entries, any alternative if join not available?

cruppstahl commented 6 years ago

For full table scans you can use a nested loop with cursors. For optimization, the outer loop should have a higher selectivity, i.e. it should return fewer results than the inner loop.

See the sample env2.c line 225 for a join based on the key values, i.e. without a full table scan. The outer loop is implemented with a cursor. The inner lookup uses ham_db_find/ham_cursor_find.