Skip to content

Add search parameters to EXPLAIN (SETTINGS)#697

Open
ankane wants to merge 1 commit intomasterfrom
guc-explain
Open

Add search parameters to EXPLAIN (SETTINGS)#697
ankane wants to merge 1 commit intomasterfrom
guc-explain

Conversation

@ankane
Copy link
Member

@ankane ankane commented Oct 22, 2024

Wanted to get feedback on this, which adds search parameters with non-default values to EXPLAIN (SETTINGS).

EXPLAIN (SETTINGS) SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
                                       QUERY PLAN                                        
-----------------------------------------------------------------------------------------
 Limit  (cost=8.02..12.04 rows=2 width=48)
   ->  Index Scan using items_embedding_idx on items  (cost=8.02..12.04 rows=2 width=48)
         Order By: (embedding <-> '[3,1,2]'::vector)
 Settings: hnsw.iterative_search = 'relaxed_order'

This seems useful for debugging, but the downside is it'll appear for all queries, not just ones that consider an approximate index.

@jkatz
Copy link
Contributor

jkatz commented Oct 23, 2024

Awesome. I think even for the cases it doesn't use the index, it could be helpful to know the parameter setting, as that could ultimately involve tweaking the parameter / indexing strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants