| From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Declarative partitioning |
| Date: | 2016-05-18 01:26:51 |
| Message-ID: | 573BC4DB.2040507@lab.ntt.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2016/05/18 2:22, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> writes:
>> On 2016/05/16 22:12, Ildar Musin wrote:
>>> Could you please tell is
>>> it possible that relcache invalidation occurs during SELECT/UPDATE/DELETE
>>> query?
>
>> Hmm, I think invalidation would not occur mid-query since it would have
>> acquired a lock on the table.
>
> This is incorrect: invalidation can occur anyway (for example, if
> autoanalyze updates the relation's statistics). If you are holding
> a lock, you can expect that the relation's schema will not change more
> than your lock would allow --- but a cache flush and rebuild could happen
> underneath you, so keeping a pointer to any subsidiary relcache data
> structure is very dangerous.
I see. Thanks for clarifying.
> The two ways that we've dealt with this type of hazard are to copy data
> out of the relcache before using it; or to give the relcache the
> responsibility of not moving a particular portion of data if it did not
> change. From memory, the latter applies to the tuple descriptor and
> trigger data, but we've done most other things the first way.
It seems that tuple descriptor is reference-counted; however trigger data
is copied. The former seems to have been done on performance grounds (I
found 06e10abc).
So for a performance-sensitive relcache data structure, refcounting is the
way to go (although done quite rarely)? In this particular case, it is a
"partition descriptor" that could get big for a partitioned table with
partitions in hundreds or thousands.
Thanks,
Amit
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2016-05-18 03:06:52 | roadmap sharing |
| Previous Message | Peter Geoghegan | 2016-05-17 22:40:47 | Re: Parallel query and temp_file_limit |