~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/backend/nodes/tidbitmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * of lossiness.  In theory we could fall back to page ranges at some
20
20
 * point, but for now that seems useless complexity.
21
21
 *
22
 
 * We also support the notion of candidate matches, or rechecking.  This
 
22
 * We also support the notion of candidate matches, or rechecking.      This
23
23
 * means we know that a search need visit only some tuples on a page,
24
24
 * but we are not certain that all of those tuples are real matches.
25
25
 * So the eventual heap scan must recheck the quals for these tuples only,
32
32
 * Copyright (c) 2003-2009, PostgreSQL Global Development Group
33
33
 *
34
34
 * IDENTIFICATION
35
 
 *        $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.18 2009/03/24 20:17:14 tgl Exp $
 
35
 *        $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.19 2009/06/11 14:48:58 momjian Exp $
36
36
 *
37
37
 *-------------------------------------------------------------------------
38
38
 */
143
143
 
144
144
/*
145
145
 * When iterating over a bitmap in sorted order, a TBMIterator is used to
146
 
 * track our progress.  There can be several iterators scanning the same
 
146
 * track our progress.  There can be several iterators scanning the same
147
147
 * bitmap concurrently.  Note that the bitmap becomes read-only as soon as
148
148
 * any iterator is created.
149
149
 */
511
511
        else if (tbm_page_is_lossy(b, apage->blockno))
512
512
        {
513
513
                /*
514
 
                 * Some of the tuples in 'a' might not satisfy the quals for 'b',
515
 
                 * but because the page 'b' is lossy, we don't know which ones.
516
 
                 * Therefore we mark 'a' as requiring rechecks, to indicate that
517
 
                 * at most those tuples set in 'a' are matches.
 
514
                 * Some of the tuples in 'a' might not satisfy the quals for 'b', but
 
515
                 * because the page 'b' is lossy, we don't know which ones. Therefore
 
516
                 * we mark 'a' as requiring rechecks, to indicate that at most those
 
517
                 * tuples set in 'a' are matches.
518
518
                 */
519
519
                apage->recheck = true;
520
520
                return false;
573
573
         * needs of the TBMIterateResult sub-struct.
574
574
         */
575
575
        iterator = (TBMIterator *) palloc(sizeof(TBMIterator) +
576
 
                                                                          MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber));
 
576
                                                                 MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber));
577
577
        iterator->tbm = tbm;
578
578
 
579
579
        /*
584
584
        iterator->schunkbit = 0;
585
585
 
586
586
        /*
587
 
         * If we have a hashtable, create and fill the sorted page lists,
588
 
         * unless we already did that for a previous iterator.  Note that the
589
 
         * lists are attached to the bitmap not the iterator, so they can be
590
 
         * used by more than one iterator.
 
587
         * If we have a hashtable, create and fill the sorted page lists, unless
 
588
         * we already did that for a previous iterator.  Note that the lists are
 
589
         * attached to the bitmap not the iterator, so they can be used by more
 
590
         * than one iterator.
591
591
         */
592
592
        if (tbm->status == TBM_HASH && !tbm->iterating)
593
593
        {
644
644
TBMIterateResult *
645
645
tbm_iterate(TBMIterator *iterator)
646
646
{
647
 
        TIDBitmap *tbm = iterator->tbm;
 
647
        TIDBitmap  *tbm = iterator->tbm;
648
648
        TBMIterateResult *output = &(iterator->output);
649
649
 
650
650
        Assert(tbm->iterating);