Plan structure
Hi
I am trying to add a query progress indicator in postgres.Being a
novice to the code I need help on few topics.
1.Where can we keep such a progress indicator code ?
2.What is the exact structure of plan returned by the planner ?
3.Does the planner return the estimates calculated while deciding the
plan ?
4.If not , then from where can we obtain those estimates ( estimates
taken to decide the best plan ) ?
I will be very thankful if someone can throw light in these
issues and provide some related guidance
regards
Anuj
On Sat, Oct 15, 2005 at 10:19:44PM +0530, Anuj Tripathi wrote:
Hi
I am trying to add a query progress indicator in postgres.Being a
novice to the code I need help on few topics.
1.Where can we keep such a progress indicator code ?
2.What is the exact structure of plan returned by the planner ?
3.Does the planner return the estimates calculated while deciding the
plan ?
4.If not , then from where can we obtain those estimates ( estimates
taken to decide the best plan ) ?
I suggest you look at executor/execProcnode.c. Every time a node in the
execution tree is executed, it will call ExecProcNode. What you are
trying to do is related to the EXPLAIN ANALYZE instrumentation
(InstrStartNode/InstrStopNode).
The comment at the top of that file is also a good explanation of how
the executor works. The executor deals with PlanState structures
(defined in include/nodes/execnodes.h), one of whose members (plan) is
a pointer to the original plan node. The Plan structure (defined in
include/nodes/plannodes.h) contains the fields you're looking for
(startup_cost, total_cost and plan_rows).
Read the comments in those files, they are generally very enlightening
as to how it all works. Also, there are various README files in the
directories which also provide additional info.
Hopefully this answers your questions.
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.
Martijn van Oosterhout <kleptog@svana.org> writes:
Read the comments in those files, they are generally very enlightening
as to how it all works. Also, there are various README files in the
directories which also provide additional info.
executor/README is a good place to start for the executor.
regards, tom lane