From: hlinnaka (@hlinnaka) <noreply+hlinnaka@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #282: Hnsw iterator
Date: Thu, 05 Oct 2023 12:26:24 +0000
Message-ID: <gh-pgvector-pgvector-282-c1748795028@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-282@github.com>
References: <gh-pgvector-pgvector-282@github.com>
> > That happens to work, though.
>
> Sorry, but why `UNION ALL` and not `UNION`? `UNION ALL` doesn't remove duplicates so for it order is not important.
The query has an ORDER BY. The planner chooses to implement that with MergeAppend over already-sorted outputs from two branches of the UNION ALL.