Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
Submit a Q&A Request a Q&A Open Questions

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $65.00
Net Balance: $61.80
Left to go: $38.20

Donations
studioC  ($25)May-17
Anonymous ($15)May-16
Anonymous ($25)May-4

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

How do I...

modify the confirmation email

Answer here!

Did you know ?

that you can open your closed site in the database when you can´t login anymore?

More details...

Random question

When some users post a topic and when it is posted you can see html code within the message ie <b> <a>/ etc. how can I stop this from happening.<br /><br />Thanks

Answer here!

Recent Q&A List

Cumulus Tag Cloud

2 2.5 2.6 3.0 2013 Abuse adslight AntiHarvesting AntiMalUser AntiSpam API Australia Ban banner Beats billige black Blocks blue Captcha cell Christmas chronolabs content Conversion database demo docek download Dresses editor evden eve facebook floor free Google herre Honeypot Human IP jQuery kantor lamps Legal log logger Logging mobile module modules Monster MyAlbum-p Networks newbb news Notices online PageRank pdf Permissions pink Plugin portal Prevention profile project Protector publisher release Rights rmcommon Room sale security SERIAL Server site Smarty Spam statistics stem Studio tag tags tdmcreate template Theme themes userlog website Whitepaper XML XooLaT xoops Xoopspoll Xortify xthemes Yolande ZendFramework

New Users

Registering user

# 136009

aloliveira

Welcome to XOOPS!
SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)

Question
How can I track down the cause of excessive database queries?
Answer
--- Original details submitted by David_L on 2005/4/19 0:01:56

Here's a hack you can use to log all database queries, along with some information that identifies the user.

You'll need to change "/example/path" to specify the path to a writable directory for the log files. This directory should be protected from viewing from a web browser.

A new log file is created each hour. The log files may consume a lot of disk space, so monitor them.

class/database/mysqldatabase.php (function queryF in class XoopsMySQLDatabase)

#*#DEBUG# - start
$logdir  '/example/path'### path to writable directory ###
$logext  'log'// log file extension
$now     time();
$ymdhms  date('Y-m-d H:i:s'$now);
$ymdh    date('Y-m-d-H'$now);
$sql_q   addcslashes($sql"rnt");
$logfile "$logdir/$ymdh.$logext";
error_log("[$ymdhms] [{$_SERVER["REQUEST_METHOD"]}] [{$_SERVER['REMOTE_ADDR']}] [{$_SERVER['HTTP_USER_AGENT']}] [{$_SERVER["SCRIPT_NAME"]}] [$sql_q]n"3$logfile);
chmod($logfile0666);
#*#DEBUG# - end
$result =& mysql_query($sql$this->conn);



--- Additional details submitted by Madfish

You can also find the number of database queries for page loads by turning on debug mode (in admin -> system -> preferences -> general).

This will display the number of SQL queries at the bottom of each page, and you can click on the link to get a list of what all the queries were, which will help identify the problem areas. Turning them off and reloading the page will allow improvements (or not!) to be assessed.

Requested by Dave_L and Answered by Mamba on 2007/1/19 3:55:07 (5382 reads)   Print Q&A Send Q&A