[dev] horde/scripts/alarms.php
Matt Selsky
selsky at columbia.edu
Wed Jul 9 18:16:09 UTC 2008
> But wouldn't it be better to try to reduce the number of statements at
> first place,
> since this script should be running periodically every 5 minutes as suggested?
According to this artcile from 2006:
http://www.mysqlperformanceblog.com/2006/08/02/mysql-prepared-statements/
"Do not forget to close prepared statements - Many memory leaks reported
in MySQL Server turned out to be prepare statements or cursors which
were forgotten to be closed. Watch Com_stmt_prepare and Com_stmt_close
to see if you’re closing all prepared statements. In newer versions you
can also use prepared_stmt_count variable to track number of open
statements diretly. You can also adjust max_prepared_stmt_count variable
which limits how many statements can be open at the same time to avoid
overload.
Check execution rate You can take a look at Com_stmt_execute to
Com_stmt_prepare ratio to see how many times each statement is executed.
If it is executed only once standard statements might be better for you,
or might be you just need to cache prepared statements in your
application (avoid closing and recycle). Note in some cases it still can
be better to use prepared statements even if you use each only once due
to data conversion."
Can you check the results of "SHOW STATUS LIKE 'Com_stmt_%" and "SHOW
STATUS LIKE 'qc%" ?
See also
http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html
Likely we need to call MDB2's free() on our prepared statements. And we
may need to call freePrepared() on the DB prepared statements.
--
Matt
More information about the dev
mailing list