* build_join_rel_hash * Construct the auxiliary hash table for join relations. */
| 530 | * Construct the auxiliary hash table for join relations. |
| 531 | */ |
| 532 | static void |
| 533 | build_join_rel_hash(PlannerInfo *root) |
| 534 | { |
| 535 | HTAB *hashtab; |
| 536 | HASHCTL hash_ctl; |
| 537 | ListCell *l; |
| 538 | |
| 539 | /* Create the hash table */ |
| 540 | hash_ctl.keysize = sizeof(Relids); |
| 541 | hash_ctl.entrysize = sizeof(JoinHashEntry); |
| 542 | hash_ctl.hash = bitmap_hash; |
| 543 | hash_ctl.match = bitmap_match; |
| 544 | hash_ctl.hcxt = CurrentMemoryContext; |
| 545 | hashtab = hash_create("JoinRelHashTable", |
| 546 | 256L, |
| 547 | &hash_ctl, |
| 548 | HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); |
| 549 | |
| 550 | /* Insert all the already-existing joinrels */ |
| 551 | foreach(l, root->join_rel_list) |
| 552 | { |
| 553 | RelOptInfo *rel = (RelOptInfo *) lfirst(l); |
| 554 | JoinHashEntry *hentry; |
| 555 | bool found; |
| 556 | |
| 557 | hentry = (JoinHashEntry *) hash_search(hashtab, |
| 558 | &(rel->relids), |
| 559 | HASH_ENTER, |
| 560 | &found); |
| 561 | Assert(!found); |
| 562 | hentry->join_rel = rel; |
| 563 | } |
| 564 | |
| 565 | root->join_rel_hash = hashtab; |
| 566 | } |
| 567 | |
| 568 | /* |
| 569 | * find_join_rel |
no test coverage detected