Buffer Cache Problem

2023-11-07 Thread jacktby jacktby
Hi, postgres hackers, I’m studying postgres buffer cache part. So I open this thread to communicate some buffer cache codes design and try to improve some tricky codes. For Buffer Cache, we know it’s a buffer array, every bucket of this array is consist of a data page and its header which is us

Re: Buffer Cache Problem

2023-11-10 Thread jacktby jacktby
In the bus_internal.h,I see Note: Buffer header lock (BM_LOCKED flag) must be held to examine or change tag, state or wait_backend_pgprocno fields. As we all know, this buffer header lock is

Re: Buffer Cache Problem

2023-11-10 Thread jacktby jacktby
> 2023年11月10日 22:31,jacktby jacktby 写道: > > In the bus_internal.h,I see > > Note: Buffer header lock (BM_LOCKED flag) must be held to examine or change > tag, state or wait_backe

Re: Buffer Cache Problem

2023-11-10 Thread jacktby jacktby
Hi, I have 3 questions here: 1. I see comments in but_internals.h below: * Also, in places we do one-time reads of the flags without bothering to * lock the buffer header; this is generally for situations where we don't * expect the flag bit being tested

Does pg support to write a new buffer cache as an extension?

2023-11-23 Thread jacktby jacktby

Is there a complete doc to describe pg's traction implementation in detail?

2023-09-01 Thread jacktby jacktby

How to add a new pg oid?

2023-09-05 Thread jacktby jacktby

Re: How to add a new pg oid?

2023-09-05 Thread jacktby jacktby
> 2023年9月5日 22:29,jacktby jacktby 写道: > I’m trying to add a new data type for my pg. How to do that? Can you give me more details or an example?

Re: How to add a new pg oid?

2023-09-06 Thread jacktby jacktby
> 2023年9月6日 01:47,David G. Johnston 写道: > > OIDs don't exist independently of the data they are associated with. Give > more context if you want a better answer. Or just go look at the source code > commits for when the last time something needing an OID got added to the core > catalog. >

Re: How to add a new pg oid?

2023-09-06 Thread jacktby jacktby
> 2023年9月6日 18:19,jacktby jacktby 写道: > > > >> 2023年9月6日 01:47,David G. Johnston 写道: >> >> OIDs don't exist independently of the data they are associated with. Give >> more context if you want a better answer. Or just go look at the sourc

Re: How to add a new pg oid?

2023-09-06 Thread jacktby jacktby
> 2023年9月6日 18:50,jacktby jacktby 写道: > > > >> 2023年9月6日 18:19,jacktby jacktby 写道: >> >> >> >>> 2023年9月6日 01:47,David G. Johnston 写道: >>> >>> OIDs don't exist independently of the data they are associated with. Giv

How to add built-in func?

2023-09-11 Thread jacktby jacktby
I only add below: Datum fake_dinstance2(PG_FUNCTION_ARGS) { PG_RETURN_INT16(0); } in src/backend/utils/adt/int8.c, and the I run “make install”, But I can’t find the fake_distance2 in src/backend/utils/fmgrtab.c which is generated by src/backend/utils/Gen_fmgrtab.pl. What else do I need t

Re: How to add built-in func?

2023-09-11 Thread jacktby jacktby
> 2023年9月11日 23:51,Aleksander Alekseev 写道: > > Hi, > >> I only add below: >> >> Datum fake_dinstance2(PG_FUNCTION_ARGS) >> { >>PG_RETURN_INT16(0); >> } >> in src/backend/utils/adt/int8.c, and the I run “make install”, >> But I can’t find the fake_distance2 in src/backend/utils/fmgrta

Re: How to add built-in func?

2023-09-11 Thread jacktby jacktby
> 2023年9月12日 00:34,Chapman Flack 写道: > > On 2023-09-11 12:28, jacktby jacktby wrote: >>> 2023年9月11日 23:51,Aleksander Alekseev 写道: >>> often better) add a corresponding extension to /contrib/. You can find >>> a complete example here [1] for instance, se

What's the eviction algorithm of newest pg version?

2023-09-14 Thread jacktby jacktby
A normal LRU cache or implement it reference to a research paper?

Buffer ReadMe Confuse

2023-09-14 Thread jacktby jacktby
In buffer README, I see “Pins may not be held across transaction boundaries, however.” I think for different transactions, they can pin the same buffer page, why not? For concurrent read transactions, they could read the one and the same buffer page.

Implement a column store for pg?

2023-09-15 Thread jacktby jacktby
I’m trying to implement a new column store for pg, is there a good example to reference?

Re: Implement a column store for pg?

2023-09-15 Thread jacktby jacktby
> 2023年9月15日 20:31,jacktby jacktby 写道: > > I’m trying to implement a new column store for pg, is there a good example to > reference? That’s too complex, I just need to know the interface about design a column store. In fact, I just need a simple example, and I will implement i

How to Know the number of attrs?

2023-09-24 Thread jacktby jacktby
typedef struct TupleDescData { int natts; /* number of attributes in the tuple */ Oid tdtypeid; /* composite type ID for tuple type */ int32 tdtypmod; /* typmod for tuple type */

How to Know the number of attrs?

2023-09-24 Thread jacktby jacktby
typedef struct TupleDescData { int natts; /* number of attributes in the tuple */ Oid tdtypeid; /* composite type ID for tuple type */ int32 tdtypmod; /* typmod for tuple type */

Why need a lock?

2023-09-25 Thread jacktby jacktby
I find this in source code #define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */ I think if there is no CONCURRENTLY, so why we need a lock, I think that’s unnecessary. What’s the point?

What's the ItemPointer's meaning here?

2023-09-26 Thread jacktby jacktby
/* Typedef for callback function for table_index_build_scan */ typedef void (*IndexBuildCallback) (Relation index, ItemPointer tid, Datum *values,

Index AmInsert Parameter Confused?

2023-09-26 Thread jacktby jacktby
typedef bool (*aminsert_function) (Relation indexRelation, Datum *values, bool *isnull, ItemPoint

Re: Index AmInsert Parameter Confused?

2023-09-26 Thread jacktby jacktby
> 2023年9月27日 00:45,Matthias van de Meent 写道: > > On Tue, 26 Sept 2023 at 18:38, jacktby jacktby wrote: >> >> typedef bool (*aminsert_function) (Relation indexRelation, >> Datum *values, >> bool *isnull, >> ItemPointer heap_tid, >> Relation h

Re: Index AmInsert Parameter Confused?

2023-09-27 Thread jacktby jacktby
> 2023年9月27日 18:08,Matthias van de Meent 写道: > > On Wed, 27 Sept 2023 at 05:03, jacktby jacktby <mailto:jack...@gmail.com>> wrote: >> >> >> >>> 2023年9月27日 00:45,Matthias van de Meent 写道: >>> >>> On Tue, 26 Sept

Set enable_seqscan doesn't take effect?

2023-09-27 Thread jacktby jacktby
postgres=# SET enable_seqscan = off; SET postgres=# explain select * from t; QUERY PLAN - Seq Scan on t (cost=100.00..123.60 rows=1360 width=32) (

Re: Set enable_seqscan doesn't take effect?

2023-09-27 Thread jacktby jacktby
> 2023年9月28日 01:07,Andres Freund 写道: > > Hi, > > On 2023-09-28 00:37:41 +0800, jacktby jacktby wrote: >> postgres=# SET enable_seqscan = off; >> SET >> postgres=# explain select * from t; >>

Re: Set enable_seqscan doesn't take effect?

2023-09-27 Thread jacktby jacktby
> 2023年9月28日 01:07,Andres Freund 写道: > > Hi, > > On 2023-09-28 00:37:41 +0800, jacktby jacktby wrote: >> postgres=# SET enable_seqscan = off; >> SET >> postgres=# explain select * from t; >>

Re: Set enable_seqscan doesn't take effect?

2023-09-28 Thread jacktby jacktby
> 2023年9月28日 01:07,Andres Freund 写道: > > Hi, > > On 2023-09-28 00:37:41 +0800, jacktby jacktby wrote: >> postgres=# SET enable_seqscan = off; >> SET >> postgres=# explain select * from t; >>

Re: Set enable_seqscan doesn't take effect?

2023-09-28 Thread jacktby jacktby
> 2023年9月28日 12:26,David G. Johnston 写道: > > On Wednesday, September 27, 2023, jacktby jacktby <mailto:jack...@gmail.com>> wrote: >> postgres=# SET enable_seqscan = off; >> SET >> postgres=# explain select * from t; >>

How to add a new operator for parser?

2023-08-05 Thread jacktby jacktby
I’m trying to add a new operator for my pg application like greater_equals called “<~>", how many files I need to modify and how to do it? Can you give me an example?

Re: How to add a new operator for parser?

2023-08-05 Thread jacktby jacktby
> 2023年8月6日 13:18,Julien Rouhaud 写道: > > On Sun, 6 Aug 2023, 12:34 jacktby jacktby, <mailto:jack...@gmail.com>> wrote: >> I’m trying to add a new operator for my pg application like greater_equals >> called “<~>", how many files I need to >&