You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blcost.c 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*-------------------------------------------------------------------------
  2. *
  3. * blcost.c
  4. * Cost estimate function for bloom indexes.
  5. *
  6. * Copyright (c) 2016-2019, PostgreSQL Global Development Group
  7. *
  8. * IDENTIFICATION
  9. * contrib/bloom/blcost.c
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #include "postgres.h"
  14. #include "fmgr.h"
  15. #include "optimizer/cost.h"
  16. #include "utils/selfuncs.h"
  17. #include "bloom.h"
  18. /*
  19. * Estimate cost of bloom index scan.
  20. */
  21. void
  22. blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
  23. Cost *indexStartupCost, Cost *indexTotalCost,
  24. Selectivity *indexSelectivity, double *indexCorrelation,
  25. double *indexPages)
  26. {
  27. IndexOptInfo *index = path->indexinfo;
  28. List *qinfos;
  29. GenericCosts costs;
  30. /* Do preliminary analysis of indexquals */
  31. qinfos = deconstruct_indexquals(path);
  32. MemSet(&costs, 0, sizeof(costs));
  33. /* We have to visit all index tuples anyway */
  34. costs.numIndexTuples = index->tuples;
  35. /* Use generic estimate */
  36. genericcostestimate(root, path, loop_count, qinfos, &costs);
  37. *indexStartupCost = costs.indexStartupCost;
  38. *indexTotalCost = costs.indexTotalCost;
  39. *indexSelectivity = costs.indexSelectivity;
  40. *indexCorrelation = costs.indexCorrelation;
  41. *indexPages = costs.numIndexPages;
  42. }