[PHP-DB] Re: Delete from mysql table is there a way to....

2002-04-15 Thread phplists

I'm not sure how to change DELETE statements in this fashion, but is there a
way maybe to run an OPTIMIZE TABLE query every so often in your PHP script..
I don't imagine you'd want it running too often since it locks the table you
run it on, but maybe on the reload of $PHP_SELF or something.. It can take a
while to run on tables with lots of data, so it may not be the best option
anyway.. Just a thought though.. Ooh, maybe a PHP script run from a cron job
every couple hours or something even??

Later,

Bob Weaver

Jennifer Downey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 I'm not sure if my first post showed up so I am going to post it again and
I
 apologize if it shows up twice.

 Is there a way to delete a record from a mysql table without fragmenting
the
 db?

 Here is the query I am using and it does a horrible job. Fragment city.



 if ($quantity == 0)
  {
 $gone = mysql_query(DELETE FROM {$config[prefix]}_my_items WHERE
 uid={$session[uid]} AND id = '$item');
   }




 Thanks
 Jennifer


 --
 The sleeper has awaken


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: Delete from mysql table is there a way to....

2002-04-15 Thread phplists

Maybe if you ran the delete query, then the optimize table query immed
after, it wouldn't take such a long time.. I would imagine if you had quite
large tables though, it could still take some time.. And if users are
connecting over the internet, you don't want too may delays..

If the user doesn't need any specific feedback about the delete command, you
could do a low priority delete.. That's sketchy at best though from what I
could gather in the manual and around. It just queues the query until the
database is done with everything but it sounds like it might release the
user/client to go on with what they're doing..

You might also check into truncate.. The mysql manual talks about it
briefly.. I guess it's an Oracle thing that mysql supports.. It sounds like
it would keep things clean but sounds slow possibly..

Later,

Bob

Jennifer Downey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 I'm not sure if my first post showed up so I am going to post it again and
I
 apologize if it shows up twice.

 Is there a way to delete a record from a mysql table without fragmenting
the
 db?

 Here is the query I am using and it does a horrible job. Fragment city.



 if ($quantity == 0)
  {
 $gone = mysql_query(DELETE FROM {$config[prefix]}_my_items WHERE
 uid={$session[uid]} AND id = '$item');
   }




 Thanks
 Jennifer


 --
 The sleeper has awaken


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php