diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2002-04-20 21:56:15 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2002-04-20 21:56:15 +0000 |
commit | 32c6c99e0b0172e13dd761f3378b328d1e6a6dab (patch) | |
tree | 15614b13dcb3235008eadc7c52879892fe34a1cb /src/backend/tcop/postgres.c | |
parent | ff4281472a973e8610a5f8455e14dec9ea85936d (diff) | |
download | postgresql-32c6c99e0b0172e13dd761f3378b328d1e6a6dab.tar.gz postgresql-32c6c99e0b0172e13dd761f3378b328d1e6a6dab.zip |
Scanner performance improvements
Use flex flags -CF. Pass the to-be-scanned string around as StringInfo
type, to avoid querying the length repeatedly. Clean up some code and
remove lex-compatibility cruft. Escape backslash sequences inline. Use
flex-provided yy_scan_buffer() function to set up input, rather than using
myinput().
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index d8c2065258b..5305f1b2f75 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.261 2002/04/18 20:01:09 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.262 2002/04/20 21:56:15 petere Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -120,7 +120,7 @@ int XfuncMode = 0; static int InteractiveBackend(StringInfo inBuf); static int SocketBackend(StringInfo inBuf); static int ReadCommand(StringInfo inBuf); -static List *pg_parse_query(char *query_string, Oid *typev, int nargs); +static List *pg_parse_query(StringInfo query_string, Oid *typev, int nargs); static List *pg_analyze_and_rewrite(Node *parsetree); static void start_xact_command(void); static void finish_xact_command(void); @@ -330,11 +330,15 @@ pg_parse_and_rewrite(char *query_string, /* string to execute */ List *raw_parsetree_list; List *querytree_list; List *list_item; + StringInfoData stri; + + initStringInfo(&stri); + appendStringInfo(&stri, "%s", query_string); /* * (1) parse the request string into a list of raw parse trees. */ - raw_parsetree_list = pg_parse_query(query_string, typev, nargs); + raw_parsetree_list = pg_parse_query(&stri, typev, nargs); /* * (2) Do parse analysis and rule rewrite. @@ -365,12 +369,12 @@ pg_parse_and_rewrite(char *query_string, /* string to execute */ * commands are not processed any further than the raw parse stage. */ static List * -pg_parse_query(char *query_string, Oid *typev, int nargs) +pg_parse_query(StringInfo query_string, Oid *typev, int nargs) { List *raw_parsetree_list; if (Debug_print_query) - elog(LOG, "query: %s", query_string); + elog(LOG, "query: %s", query_string->data); if (Show_parser_stats) ResetUsage(); @@ -549,7 +553,7 @@ pg_plan_query(Query *querytree) */ void -pg_exec_query_string(char *query_string, /* string to execute */ +pg_exec_query_string(StringInfo query_string, /* string to execute */ CommandDest dest, /* where results should go */ MemoryContext parse_context) /* context for * parsetrees */ @@ -559,7 +563,7 @@ pg_exec_query_string(char *query_string, /* string to execute */ List *parsetree_list, *parsetree_item; - debug_query_string = query_string; /* used by pgmonitor */ + debug_query_string = query_string->data; /* used by pgmonitor */ /* * Start up a transaction command. All queries generated by the @@ -725,7 +729,7 @@ pg_exec_query_string(char *query_string, /* string to execute */ * process utility functions (create, destroy, etc..) */ if (Debug_print_query) - elog(LOG, "ProcessUtility: %s", query_string); + elog(LOG, "ProcessUtility: %s", query_string->data); else elog(DEBUG2, "ProcessUtility"); if (querytree->originalQuery) @@ -1688,7 +1692,7 @@ PostgresMain(int argc, char *argv[], const char *username) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.261 $ $Date: 2002/04/18 20:01:09 $\n"); + puts("$Revision: 1.262 $ $Date: 2002/04/20 21:56:15 $\n"); } /* @@ -1913,7 +1917,7 @@ PostgresMain(int argc, char *argv[], const char *username) pgstat_report_activity(parser_input->data); - pg_exec_query_string(parser_input->data, + pg_exec_query_string(parser_input, whereToSendOutput, QueryContext); |