Re: Plan structure
От | Martijn van Oosterhout |
---|---|
Тема | Re: Plan structure |
Дата | |
Msg-id | 20051015180913.GE14113@svana.org обсуждение исходный текст |
Ответ на | Plan structure (Anuj Tripathi <anujt@it.iitb.ac.in>) |
Ответы |
Re: Plan structure
|
Список | pgsql-hackers |
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/ > 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.
В списке pgsql-hackers по дате отправления: