[HACKERS] How to hack the storage component?
Hi folks, Currently, I'm trying to read the storage component, since it's biased towards the lower layer, seems more difficult to understand and debug. All the materials I have found are the original papers on http://db.cs.berkeley.edu, I'm wondering how much it have been changed since Postgres. Could you please give me some suggestions? Thanks. Regards. Chaoyong Wang
[HACKERS] Re: [HACKERS] How to hack the storage component?
Thank you very much. Based on your information, I find an interesting page including your comment: http://code.metager.de/source/history/postgresql/src/backend/storage/smgr/README . Seems all guys are in the core team, really nice job. Thanks again for your kind reply and 2 phase commit contribution. Regards. Chaoyong Wang On Fri, Jan 18, 2013 at 5:26 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 18.01.2013 11:02, wang chaoyong wrote: Hi folks, Currently, I'm trying to read the storage component, since it's biased towards the lower layer, seems more difficult to understand and debug. All the materials I have found are the original papers on http://db.cs.berkeley.edu, I'm wondering how much it have been changed since Postgres. Could you please give me some suggestions? Thanks. It has changed a lot since the Berkeley times. I doubt the original papers are of much use anymore in understanding modern PostgreSQL. You'll want to read src/backend/storage/smgr/**README, although there isn't much there. Also make sure you read the Database Physical Storage section in the user manual, http://www.postgresql.org/**docs/devel/static/storage.htmlhttp://www.postgresql.org/docs/devel/static/storage.html **. - Heikki
[HACKERS] problem when optimizing the window aggregation
Hi, I'm trying to reduce the re-computing of window aggregation. Here the AVG function for example. The original window aggregation's transition value(transValue) of AVG is an ArrayType, that contains two main values(sum, count). Now, I'm using a temporary transition value (tempTransValue), and I need to copy tempTransValue to transValue. I used the function datumCopy as following: peraggstate-transValue = datumCopy(peraggstate-tempTransValue, peraggstate-transtypeByVal, peraggstate-transtypeLen); But when the copied transValue is passed to the invoke function, here is int4_avg_accum, the ArrayType returned from PG_GETARG_ARRAYTYPE_P(0) is null. Which means the copy action is failed. Anybody know why? Or give me some suggestions? Thanks very much. Best Regards Chaoyong Wang
Re: [HACKERS] problem when optimizing the window aggregation
Thanks again, the reason is found. The following statement frees all the context for aggregation, including the transValue and tempTransValue: MemoryContextResetAndDeleteChildren(winstate-aggcontext); -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: 2012年8月22日 9:47 To: Wang, Chaoyong Cc: pgsql-hackers@postgresql.org Subject: Re: [HACKERS] problem when optimizing the window aggregation Wang, Chaoyong chaoyong.w...@emc.com writes: I used the function datumCopy as following: peraggstate-transValue = datumCopy(peraggstate-tempTransValue, peraggstate-transtypeByVal, peraggstate-transtypeLen); You need to guard that with an is-null check, because datumCopy isn't designed to cope with null values. (Which is historical, I guess, but we're not likely to change it now.) If you look around you will find plenty of examples of this coding pattern. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers