pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: rferraton (@rferraton) <noreply+rferraton@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #781: index not used with cte
Date: Fri, 21 Feb 2025 17:47:45 +0000
Message-ID: <gh-pgvector-pgvector-781-c2675185821@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-781@github.com>
References: <gh-pgvector-pgvector-781@github.com>

No, if i set the enable_seqscan = off the plan is the following one (still full scan, the cost is 10B but it does not use the index ! ): 

```
Limit  (cost=10000083624.74..10000083624.76 rows=10 width=27) (actual time=4243.354..4243.366 rows=10 loops=1)
  Output: a.title, ((dbpedia_14.chunk_embedding <-> a.chunk_embedding))
  ->  Sort  (cost=10000083624.74..10000085199.92 rows=630073 width=27) (actual time=4122.775..4122.786 rows=10 loops=1)
        Output: a.title, ((dbpedia_14.chunk_embedding <-> a.chunk_embedding))
        Sort Key: ((dbpedia_14.chunk_embedding <-> a.chunk_embedding))
        Sort Method: top-N heapsort  Memory: 26kB
        ->  Nested Loop  (cost=10000000000.42..10000070009.08 rows=630073 width=27) (actual time=0.212..4037.134 rows=630073 loops=1)
              Output: a.title, (dbpedia_14.chunk_embedding <-> a.chunk_embedding)
              ->  Index Scan using dbpedia_14_chunk_index_idx on public.dbpedia_14  (cost=0.42..8.44 rows=1 width=18) (actual time=0.122..0.133 rows=1 loops=1)
                    Output: dbpedia_14.label, dbpedia_14.title, dbpedia_14.content, dbpedia_14.split, dbpedia_14.content_word_count, dbpedia_14.chunk, dbpedia_14.content_n_chunks, dbpedia_14.chunk_index, dbpedia_14.chunk_word_count, dbpedia_14.chunk_embedding
                    Index Cond: (dbpedia_14.chunk_index = 473679)
              ->  Seq Scan on public.dbpedia_14 a  (cost=10000000000.00..10000062124.73 rows=630073 width=37) (actual time=0.016..235.199 rows=630073 loops=1)
                    Output: a.label, a.title, a.content, a.split, a.content_word_count, a.chunk, a.content_n_chunks, a.chunk_index, a.chunk_word_count, a.chunk_embedding
Planning Time: 0.324 ms
JIT:
  Functions: 6
  Options: Inlining true, Optimization true, Expressions true, Deforming true
  Timing: Generation 8.395 ms (Deform 3.368 ms), Inlining 12.487 ms, Optimization 51.771 ms, Emission 56.318 ms, Total 128.972 ms
Execution Time: 4252.306 ms
```

view thread (11+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-781-c2675185821@github.com>
Permalink:  ../gh-pgvector-pgvector-781-c2675185821@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