pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql.pike:139:
//! Turning this on will allow multiple statements per query separated //! by semicolons (not recommended). //! @member int "sync_parse" //! Set it to zero to turn synchronous parsing off for statements. //! Setting this to off can cause surprises because statements could //! be parsed before the previous statements have been executed //! (e.g. references to temporary tables created in the preceding //! statement), //! but it can speed up parsing due to increased parallelism. //! @member int "cache_autoprepared_statements"
-
//! If set to
zero
, it
disables
the automatic statement prepare and
+
//! If set to
one
, it
enables
the automatic statement prepare and
//! cache logic; caching prepared statements can be problematic //! when stored procedures and tables are redefined which leave stale //! references in the already cached prepared statements.
-
+
//! The default is off, because PostgreSQL 10.1 (at least)
+
//! has a bug that makes it spike to 100% CPU sometimes when this is on.
//! @member string "client_encoding" //! Character encoding for the client side, it defaults to using //! the default encoding specified by the database, e.g. //! @expr{"UTF8"@} or @expr{"SQL_ASCII"@}. //! @member string "standard_conforming_strings" //! When on, backslashes in strings must not be escaped any longer, //! @[quote()] automatically adjusts quoting strategy accordingly. //! @member string "escape_string_warning" //! When on, a warning is issued if a backslash (\) appears in an //! ordinary string literal and @expr{"standard_conforming_strings"@}
pike.git/lib/modules/Sql.pmod/pgsql.pike:925:
CHAIN(cs)->add_int8('Q')->add_hstring(({q, 0}), 4, 4); cs->sendcmd(FLUSHLOGSEND, portal); } PD("Simple query: %O\n", q); } else { object plugbuffer; portal->_parseportal(); if (!sizeof(preparedname) || !tp || !tp.preparedname) { if (!sizeof(preparedname)) preparedname =
-
(portal._unnamedstatementkey = proxy.unnamedstatement->trylock(1))
+
(portal._unnamedstatementkey =
+
(
proxy.
options.cache_autoprepared_statements
+
? proxy.
unnamedstatement->trylock
+
: proxy.unnamedstatement->lock)
(1))
? "" : PTSTMTPREFIX + int2hex(ptstmtcount++); PD("Parse statement %O=%O\n", preparedname, q); plugbuffer = c->start(); CHAIN(plugbuffer)->add_int8('P') ->add_hstring(({preparedname, 0, q, "\0\0\0"}), 4, 4) #if 0 // Even though the protocol doesn't require the Parse command to be // followed by a flush, it makes a VERY noticeable difference in // performance if it is omitted; seems like a flaw in the PostgreSQL // server v8.3.3
pike.git/lib/modules/Sql.pmod/pgsql.pike:1141:
else if (!forcetext && forcecache == 1 || forcecache && sizeof(q) >= MINPREPARELENGTH) { object plugbuffer = c->start(); if (tp = proxy.prepareds[q]) { if (tp.preparedname) { #ifdef PG_STATS prepstmtused++; #endif preparedname = tp.preparedname; } else if(tp.trun && tp.tparse*FACTORPLAN >= tp.trun
-
&&
(undefinedp(
options.cache_autoprepared_statements)
-
|| options.cache_autoprepared_statements))
+
&& options.cache_autoprepared_statements)
preparedname = PREPSTMTPREFIX + int2hex(pstmtcount++); } else { if (proxy.totalhits >= cachedepth) foreach (proxy.prepareds; string ind; tp) { int oldhits = tp.hits; proxy.totalhits -= oldhits-(tp.hits = oldhits >> 1); if (oldhits <= 1) { closestatement(plugbuffer, tp.preparedname); m_delete(proxy.prepareds, ind); }