pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
6+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-08-23 21:55  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  0 siblings, 0 replies; 6+ messages in thread

From: jkatz (@jkatz) @ 2024-08-23 21:55 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

A feature targeted for PostgreSQL 18 (postgres/postgres@e2225346) that makes optimizations around disabled path nodes impacted pgvector such that PostgreSQL would choose to perform an index scan when it should have used a different scan (e.g. `SELECT count(*) FROM table`). Per upstream guidance[1], the recommendation is to switch to using `get_float8_infinity()`, which achieves the same behavior in backbranches, and can be adapated to work with the new behavior introduced in PostgreSQL 18.

[1] https://www.postgresql.org/message-id/2281822.1724441531%40sss.pgh.pa.us

inline patch 1: src/hnsw.c, src/ivfflat.c (+6/-4 lines) download inline-1.patchdiff --git a/src/hnsw.c b/src/hnsw.c index 0850a69e7..97e43a8a7 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -9,6 +9,7 @@ #include "commands/vacuum.h" #include "hnsw.h" #include "miscadmin.h" +#include "utils/float.h" #include "utils/guc.h" #include "utils/selfuncs.h" @@ -112,8 +113,8 @@ hnswcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, /* Never use index without order */ if (path->indexorderbys == NULL) { - *indexStartupCost = DBL_MAX; - *indexTotalCost = DBL_MAX; + *indexStartupCost = get_float8_infinity(); + *indexTotalCost = get_float8_infinity(); *indexSelectivity = 0; *indexCorrelation = 0; *indexPages = 0; diff --git a/src/ivfflat.c b/src/ivfflat.c index 415579b7a..a1e2e1d28 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -7,6 +7,7 @@ #include "commands/progress.h" #include "commands/vacuum.h" #include "ivfflat.h" +#include "utils/float.h" #include "utils/guc.h" #include "utils/selfuncs.h" #include "utils/spccache.h" @@ -78,8 +79,8 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, /* Never use index without order */ if (path->indexorderbys == NULL) { - *indexStartupCost = DBL_MAX; - *indexTotalCost = DBL_MAX; + *indexStartupCost = get_float8_infinity(); + *indexTotalCost = get_float8_infinity(); *indexSelectivity = 0; *indexCorrelation = 0; *indexPages = 0;
^ permalink raw [nested|flat] 6+ messages in thread

* Re: [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-08-23 22:13  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-08-23 22:13 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Thanks @jkatz, will merge once things are finalized.

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-09-20 01:01  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-09-20 01:01 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane merged this (commit 05fb382031a7).

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-09-20 01:01  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-09-20 01:01 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-09-20 01:02  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-09-20 01:02 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Looks like CI is still failing for pg18, but should be okay to merge. Thanks @jkatz!

^ permalink  raw  [nested|flat] 6+ messages in thread

* Re: [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance
@ 2024-10-22 07:48  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-10-22 07:48 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Pushed a different fix in 1291b12090bbb03bd92b92e42a1567ae5b1c96ad to address this.

^ permalink  raw  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2024-10-22 07:48 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-23 21:55 [pgvector/pgvector] PR #658: Swap max costing values to align with upstream guidance "jkatz (@jkatz)" <noreply+jkatz@github.com>
2024-08-23 22:13 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-20 01:01 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-20 01:01 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-20 01:02 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-10-22 07:48 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox