|
Posted by Jochem Maas on 08/12/05 12:35
Torgny Bjers wrote:
> FSA wrote:
>
>>hi, i have a big php script with alot of db inserts and updates, what i
>>want to do it's to log all this db commands into a table. I was wonderig
>>if there is a better way to do this than the insert into logs_table the
>>actual queryes.
>>
>>ty
>
>
> Depending the amount of queries and the number of times the actual
> script is loaded, your logs could flood very easily and bog down the
> server. These notions of logging EVERYTHING is sometimes worse than
> actually allowing the culprit script to run slowly or execute lots of
> queries. 4 GB of logfile says way less than actually reading through the
> script and checking to make sure that the queries are proper. If you are
> still intent on logging these queries, I would go with your logs_table
> idea and limit the fields and field lengths to the extreme and index it
> tightly to make sure that it does not grow too much in size, that means,
> char or varchar, and definitely no text/blob fields.
>
> If this is a web script, one idea would be to only trigger the logging
> for a specific set of IP numbers, so that only your own browser triggers
> the logging, but it is left dormant while others browse.
additionally you might want to not log each query in full but just store
a count of the number of times a given query was run - but this would probably
only be useful if you where using prepared queries - which is recommended if
your doing lots of the same ... then again your DBMS might not support that
(me I use firebird mostly - which is better ;-)
>
> Regards,
> Torgny
>
[Back to original message]
|