|
13 | 13 | <H1>Developer's Frequently Asked Questions (FAQ) for |
14 | 14 | PostgreSQL</H1> |
15 | 15 |
|
16 | | - <P>Last updated: Sun Mar 13 22:07:18 EST 2005</P> |
| 16 | + <P>Last updated: Sat Apr 23 14:57:40 EDT 2005</P> |
17 | 17 |
|
18 | 18 | <P>Current maintainer: Bruce Momjian (<A href= |
19 | 19 | "mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR> |
@@ -71,6 +71,8 @@ <H2>Technical Questions</H2> |
71 | 71 | <I>pfree</I>() to allocate memory?<BR> |
72 | 72 | <A href="#2.6">2.6</A>) What is ereport()?<BR> |
73 | 73 | <A href="#2.7">2.7</A>) What is CommandCounterIncrement()?<BR> |
| 74 | + <A href="#2.8">2.8</A>) What debugging features are available?<BR> |
| 75 | + |
74 | 76 | <BR> |
75 | 77 |
|
76 | 78 | <HR> |
@@ -941,6 +943,45 @@ <H3><A name="2.7">2.7</A>) What is CommandCounterIncrement()?</H3> |
941 | 943 | modified by previous pieces. <I>CommandCounterIncrement()</I> |
942 | 944 | increments the Command Counter, creating a new part of the |
943 | 945 | transaction.</P> |
| 946 | + |
| 947 | + <H3><A name="2.8">2.8</A>) What debugging features are |
| 948 | + available?</H3> |
| 949 | + |
| 950 | + <P>First, try running <I>configure</I> with the --enable-cassert |
| 951 | + option, many <I>assert()</I>s monitor the progress of the backend |
| 952 | + and halt the program when something unexpected occurs.</P> |
| 953 | + |
| 954 | + <P>The <I>postmaster</I> has a <I>-d</I> option that allows even more |
| 955 | + detailed information to be reported. The <I>-d</I> option takes a |
| 956 | + number that specifies the debug level. Be warned that high debug |
| 957 | + level values generate large log files.</P> |
| 958 | + |
| 959 | + <P>If the <I>postmaster</I> is not running, you can actually run the |
| 960 | + <I>postgres</I> backend from the command line, and type your |
| 961 | + <SMALL>SQL</SMALL> statement directly. This is recommended |
| 962 | + <B>only</B> for debugging purposes. If you have compiled with debugging |
| 963 | + symbols, you can use a debugger to see what is happening. Because |
| 964 | + the backend was not started from <I>postmaster</I>, it is not |
| 965 | + running in an identical environment and locking/backend interaction |
| 966 | + problems may not be duplicated.</P> |
| 967 | + |
| 968 | + <P>If the <I>postmaster</I> is running, start <I>psql</I> in one |
| 969 | + window, then find the <SMALL>PID</SMALL> of the <I>postgres</I> |
| 970 | + process used by <I>psql</I> using <CODE>SELECT pg_backend_pid()</CODE>. |
| 971 | + Use a debugger to attach to the <I>postgres</I> <SMALL>PID</SMALL>. |
| 972 | + You can set breakpoints in the debugger and issue queries from |
| 973 | + |
| 974 | + <I>psql</I>. If you are debugging <I>postgres</I> startup, you can |
| 975 | + set PGOPTIONS="-W n", then start <I>psql</I>. This will cause startup |
| 976 | + to delay for <I>n</I> seconds so you can attach to the process with |
| 977 | + the debugger, set any breakpoints, and continue through the startup |
| 978 | + sequence.</P> |
| 979 | + |
| 980 | + <P>You can also compile with profiling to see what functions are |
| 981 | + taking execution time. The backend profile files will be deposited |
| 982 | + in the <I>pgsql/data/base/dbname</I> directory. The client profile |
| 983 | + file will be put in the client's current directory. Linux requires |
| 984 | + a compile with <I>-DLINUX_PROFILE</I> for proper profiling.</P> |
944 | 985 | </BODY> |
945 | 986 | </HTML> |
946 | 987 |
|
0 commit comments