PostgreSQL Source Code: src/backend/optimizer/path/tidpath.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

40

50

51

52

53

54

55static inline bool

57{

58

60 var->vartype == TIDOID &&

62 var->varnullingrels == NULL &&

64 return true;

65 return false;

66}

67

68

69

70

71

72

73

74

75

76static bool

78{

81 *arg2,

82 *other;

84

85

87 return false;

89

90

92 return false;

95

96

97 other = NULL;

98 other_relids = NULL;

99 if (arg1 && IsA(arg1, Var) &&

101 {

102 other = arg2;

103 other_relids = rinfo->right_relids;

104 }

105 if (!other && arg2 && IsA(arg2, Var) &&

107 {

108 other = arg1;

109 other_relids = rinfo->left_relids;

110 }

111 if (!other)

112 return false;

113

114

117 return false;

118

119 return true;

120}

121

122

123

124

125

126

127

128

129

130static bool

132{

134 return false;

135

136 if (((OpExpr *) rinfo->clause)->opno == TIDEqualOperator)

137 return true;

138

139 return false;

140}

141

142

143

144

145

146

147

148

149

150static bool

152{

153 Oid opno;

154

156 return false;

158

159 if (opno == TIDLessOperator || opno == TIDLessEqOperator ||

160 opno == TIDGreaterOperator || opno == TIDGreaterEqOperator)

161 return true;

162

163 return false;

164}

165

166

167

168

169

170

171

172static bool

174{

177 *arg2;

178

179

181 return false;

183

184

185 if (node->opno != TIDEqualOperator)

186 return false;

187 if (!node->useOr)

188 return false;

192

193

194 if (arg1 && IsA(arg1, Var) &&

196 {

197

200 return false;

201

202 return true;

203 }

204

205 return false;

206}

207

208

209

210

211static bool

213{

215

216

218 return false;

220

221

223 return true;

224

225 return false;

226}

227

228

229

230

231

232

233

234static bool

236{

237

238

239

240

241 if (rinfo->pseudoconstant)

242 return false;

243

244

245

246

247

249 return false;

250

251

252

253

257 return true;

258

259 return false;

260}

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

282 bool *isCurrentOf)

283{

284 RestrictInfo *tidclause = NULL;

285 List *orlist = NIL;

287

288 *isCurrentOf = false;

289

290 foreach(l, rlist)

291 {

293

295 {

298

299

300

301

302

303 foreach(j, ((BoolExpr *) rinfo->orclause)->args)

304 {

306 List *sublist;

307

308

310 {

312 bool sublistIsCurrentOf;

313

314

316 &sublistIsCurrentOf);

317 if (sublistIsCurrentOf)

318 elog(ERROR, "IS CURRENT OF within OR clause");

319 }

320 else

321 {

323

327 else

328 sublist = NIL;

329 }

330

331

332

333

334

335 if (sublist == NIL)

336 {

337 rlst = NIL;

338 break;

339 }

340

341

342

343

345 }

346

347 if (rlst)

348 {

349

350

351

352

354 orlist = rlst;

355 }

356 }

357 else

358 {

359

361 {

362

364 {

365 *isCurrentOf = true;

367 }

368

369

370

371

372

373

374 if (tidclause == NULL)

375 tidclause = rinfo;

376 }

377 }

378 }

379

380

381

382

383

384 if (tidclause)

386 return orlist;

387}

388

389

390

391

392

393

394

395

396

399{

402

404 return NIL;

405

406 foreach(l, rlist)

407 {

409

411 rlst = lappend(rlst, rinfo);

412 }

413

414 return rlst;

415}

416

417

418

419

420

421

422

423

424

425static void

427{

429

430 foreach(l, clauses)

431 {

433 List *tidquals;

434 Relids required_outer;

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450 if (rinfo->pseudoconstant ||

453 continue;

454

455

456

457

458

459

461 continue;

462

463

465

466

469

471 required_outer));

472 }

473}

474

475

476

477

478

479

480static bool

483 void *arg)

484{

487 return true;

488 return false;

489}

490

491

492

493

494

495

496bool

498{

499 List *tidquals;

500 List *tidrangequals;

501 bool isCurrentOf;

502

503

504

505

506

507

508

509

511 &isCurrentOf);

512

514 {

515

516

517

518

520

522 required_outer));

523

524

525

526

527

528

529

530 if (isCurrentOf)

531 return true;

532 }

533

534

536 return false;

537

538

539

540

541

543 rel);

544

545 if (tidrangequals != NIL)

546 {

547

548

549

550

552

554 tidrangequals,

555 required_outer,

556 0));

557

558

560 {

561 int parallel_workers;

562

565

566 if (parallel_workers > 0)

568 rel,

569 tidrangequals,

570 required_outer,

571 parallel_workers));

572 }

573 }

574

575

576

577

578

579

581 {

582 List *clauses;

583

584

586 rel,

588 NULL,

590

591

593 }

594

595

596

597

598

599

601

602 return false;

603}

int compute_parallel_worker(RelOptInfo *rel, double heap_pages, double index_pages, int max_workers)

Bitmapset * bms_del_member(Bitmapset *a, int x)

bool bms_is_member(int x, const Bitmapset *a)

Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)

bool contain_volatile_functions(Node *clause)

int max_parallel_workers_per_gather

List * generate_implied_equalities_for_column(PlannerInfo *root, RelOptInfo *rel, ec_matches_callback_type callback, void *callback_arg, Relids prohibited_rels)

Assert(PointerIsAligned(start, uint64))

if(TABLE==NULL||TABLE_index==NULL)

List * lappend(List *list, void *datum)

List * list_concat(List *list1, const List *list2)

static bool is_andclause(const void *clause)

static bool is_opclause(const void *clause)

#define IsA(nodeptr, _type_)

#define castNode(_type_, nodeptr)

TidRangePath * create_tidrangescan_path(PlannerInfo *root, RelOptInfo *rel, List *tidrangequals, Relids required_outer, int parallel_workers)

void add_partial_path(RelOptInfo *parent_rel, Path *new_path)

TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)

void add_path(RelOptInfo *parent_rel, Path *new_path)

#define AMFLAG_HAS_TID_RANGE

#define lfirst_node(type, lc)

static int list_length(const List *l)

bool restriction_is_or_clause(RestrictInfo *restrictinfo)

bool restriction_is_securely_promotable(RestrictInfo *restrictinfo, RelOptInfo *rel)

bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel)

Relids lateral_referencers

#define SelfItemPointerAttributeNumber

static List * TidQualFromRestrictInfoList(PlannerInfo *root, List *rlist, RelOptInfo *rel, bool *isCurrentOf)

static bool IsBinaryTidClause(RestrictInfo *rinfo, RelOptInfo *rel)

static void BuildParameterizedTidPaths(PlannerInfo *root, RelOptInfo *rel, List *clauses)

static bool IsTidEqualClause(RestrictInfo *rinfo, RelOptInfo *rel)

static List * TidRangeQualFromRestrictInfoList(List *rlist, RelOptInfo *rel)

static bool IsCTIDVar(Var *var, RelOptInfo *rel)

static bool IsCurrentOfClause(RestrictInfo *rinfo, RelOptInfo *rel)

static bool RestrictInfoIsTidQual(PlannerInfo *root, RestrictInfo *rinfo, RelOptInfo *rel)

bool create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel)

static bool ec_member_matches_ctid(PlannerInfo *root, RelOptInfo *rel, EquivalenceClass *ec, EquivalenceMember *em, void *arg)

static bool IsTidRangeClause(RestrictInfo *rinfo, RelOptInfo *rel)

static bool IsTidEqualAnyClause(PlannerInfo *root, RestrictInfo *rinfo, RelOptInfo *rel)

Relids pull_varnos(PlannerInfo *root, Node *node)