Re: what's the meaning of key?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "jacktby(at)gmail(dot)com" <jacktby(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: what's the meaning of key?
Date: 2023-02-05 09:22:05
Message-ID: 038b1d45-9668-39c9-83f1-bebc8b84473f@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/02/2023 06:09, jacktby(at)gmail(dot)com wrote:
> I'm doing research on heap_am, and for heap_beginscan func, I find
> out that there is a arg called nkeys, I use some sqls as examples like
> 'select * from t;' and 'select * from t where a  = 1', but it is always
> zero,
> can you give me some descriptions for this? what's it used for?

The executor evaluates table scan quals in the SeqScan node itself, in
ExecScan function. It doesn't use the heap_beginscan scankeys.

There has been some discussion on changing that, as some table access
methods might be able to filter rows more efficiently using the scan
keys than the executor node. But that's how it currently works.

I think the heap scankeys are used by catalog accesses, though, so it's
not completely dead code.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-02-05 10:40:57 Re: Generating code for query jumbling through gen_node_support.pl
Previous Message Himanshu Upadhyaya 2023-02-05 08:57:09 Re: HOT chain validation in verify_heapam()