Jump to content

[SOLVED] Overhead? insert not always inserting?


Recommended Posts

Not sure if these are related but I have a messaging system for my users which is done to the following...

 

mysql_query("INSERT INTO message (src,dest,msg,time,inbox,crew,title,date) VALUES ('$id','$msgtoid','$msg','$time','inbox','$crw[0]','$title','$date');");

$event="You have recieved a message from <a href=profile.php?pid=$user>$pmp[0]</a>. The subject of the message is <a href=messages.php>$title</a>.";

        mysql_query("INSERT INTO newsfeed (userid,event,time) VALUES ('$id','$event','$time');");

 

 

sometimes the insert into message doesnt work it seems but the message title and such will show up in the news feed

 

also my tables constantly have a *overhead* that appears like every 12 hours and stays like that till i *optimize* the table, right now a smaller table has a over head and is seen below...

 

Space usage Type Usage

Data 107,433 B

Index 30,720 B

Overhead 4,023 B

Effective 134,130 B

Total 138,153 B

Optimize table 

 

 

is overhead bad?  I cant find much documentation about it and would having a overhead make it have spotty inserts into tables?

 

also if my database is very query intensive and information is constantly changing in some tables should i not use MyISAM?

 

Thanks for your time as I'm very confused, the database is live and gets 300k+ page views and each page view has at least 2 query statements involved

also some more information not sure if this will help...

 

This MySQL server has been running for 9 days, 2 hours, 4 minutes and 31 seconds. It started up on Jan 08, 2008 at 03:10 PM.

Query statistics: Since its startup, 298,689,482 queries have been sent to the server.

Total ø per hour ø per minute ø per second

299 M 1.37 M 22.83 k 380.46

 

 

The following are all RED numbers that i found in phpmyadmin in *status*

 

Slow_queries 4

Handler_read_rnd 15 M

Handler_read_rnd_next 276 G

Slow_launch_threads 2

Created_tmp_disk_tables 6

Sort_merge_passes 18 k

Opened_tables 30 k

Table_locks_waited 11 M

 

 

those are the ones in red, i think red is bad but who knows lol

mysql_query("INSERT INTO message (src,dest,msg,time,inbox,crew,title,date) VALUES ('$id','$msgtoid','$msg','$time','inbox','$crw[0]','$title','$date');");

$event="You have recieved a message";

        mysql_query("INSERT INTO newsfeed (userid,event,time) VALUES ('$id','$event','$time');");

 

 

they are both triggered one after another

 

seeing how newsfeed insert is after the message insert

 

so if a newsfeed insert was instructed, a message insert should of happend right before that, like i said before all the messages i send work and insert, but some people in the database seem to have issues

i think i found it while messing around

 

 

whenever someone put a ' in the message it would stop it

 

because i wasnt doing

 

$title = mysql_real_escape_string($title);

          $msg = mysql_real_escape_string($msg);

 

however i put that in there and i can now put the ' things and it goes through with that statement

 

always something simple ; P

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.