From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Sayan Biswas <formal(dot)sayan(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Modifying Postgresql Optimizer to select optimal memory |
Date: | 2014-04-01 22:45:20 |
Message-ID: | 8421.1396392320@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Sayan Biswas <formal(dot)sayan(at)gmail(dot)com> writes:
> Hello everyone,
> We are currently working on a DBMS course project that requires us to
> modify postgresql optimizer. We need to vary work_mem within a range and
> note down the cost at those points(allocated memory) after 'explain'
> operation and then select the optimal tradeoff. We were changing
> "postgresql-9.1.12/src/backend/optimizer/plan/planner.c" where we created a
> new function mem_tradeoff() that calls planner() within a for loop for the
> varying memory. This mem_tradeoff() is called from pg_plan_query() in
> "postgresql-9.1.12/src/backend/tcop/postgres.c". The problem is, if the for
> loop runs only one iteration, everything is fine, but if we print
> plan->planTree->total_cost, it is printed 132 times for any query. Also if
> the for loop runs more than one iteration, we get a segmentation fault. Any
> help is very much appreciated.
The comment on standard_planner might help you:
* Note to plugin authors: standard_planner() scribbles on its Query input,
* so you'd better copy that data structure if you want to plan more than once.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-04-01 23:00:16 | Re: simple update query stuck |
Previous Message | Stefan Keller | 2014-04-01 22:32:02 | Re: Postgres as In-Memory Database? |