Source Code Help Needed

From: Vikram Kalsi <vikramkalsi(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Source Code Help Needed
Date: 2005-05-25 18:50:38
Message-ID: ed5f0fd7050525115022954064@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I've been using Postgresql-8.0.1 (Release date: 2005-01-31) for my
research work and I guess I finally need some help with it...

I'm not trying to modify the existing functionality, but I want to add
few things. In particular, I'm calculating two new Cost values and I
need to use them while the query is executing. Please See code
snippets below-

1.) New Variables ADDED to src/include/nodes/plannodes.h
typedef struct Plan
{
Cost hutz_tbl_benefit; /* Benefit for TableAccess */
Cost hutz_idx_benefit; /* Benefit for IndexScan */
}

2.) New Variables ADDED to src/include/nodes/relation.h
typedef struct Plan
{
Cost hutz_tbl_benefit; /* Benefit for TableAccess */
Cost hutz_idx_benefit; /* Benefit for IndexScan */
}

3.) ADDITIONS to costsize.c

void cost_seqscan(Path *path, Query *root,
RelOptInfo *baserel)
{
path->hutz_tbl_benefit = xxxxx;
path->hutz_idx_benefit = xxxxx;
}

void cost_index(Path *path, Query *root, RelOptInfo *baserel,
IndexOptInfo *index, List *indexQuals, bool is_injoin)
{
path->hutz_tbl_benefit = xxxxx;
path->hutz_idx_benefit = xxxxx;
}

However, after these modifications the server process crashes on
running a Join query like
"select s_suppkey,c_custkey from supplier,customer where s_suppkey>125
and s_suppkey<128 and c_custkey>100 and c_custkey<103 and
c_custkey=s_suppkey"

But, this query runs fine "select s_suppkey from supplier where
s_suppkey>125 and s_suppkey<128"

I'm tracing the point at which the process crashes and at this point
it seems to inside
src/backend/optimizer/path/joinrels.c>>make_rels_by_joins()

So, my question is, after adding the two new variables what other
modifications do I need to make for code to work, And later on, what
changes are reqd so that I can access these variables while executing
the Query Plan in lets say ExecutePlan() and its sub-functions like
ExecProcNode()...

Thanks to everybody on this group,
-Vikram Kalsi
MSEE PennStateUniv

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Manfred Koizar 2005-05-25 19:24:24 Re: WAL replay failure after file truncation(?)
Previous Message David Parker 2005-05-25 16:03:36 logging sql from JDBC