If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > 3 seconds to run a select that returns empty set??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-09, 12:22
yalag yalag is offline
Registered User
 
Join Date: Apr 2009
Posts: 1
3 seconds to run a select that returns empty set??

Hello,

I have recently created a very simple table with 2 VARCHAR fields. I have then created a quick php script to loop through some inserts (inserted 600000 rows) and then deleted all the rows by doing "delete from Table where field1="abc" which should delete all rows. I then did a select * from Table and the query took 3 seconds! The return result set is empty!

Later I found out that if I do a delete * from Table, without a where clause. And then after tat do a select * from Table, it will take 0.0 seconds. Why is this? How to fix?


1) create table stuff (int id);


2) run php to do insert

for ( $counter = 0; $counter <= 600000; $counter ++) {
mysql_query("INSERT INTO stuff (id) VALUES(1)") or die(mysql_error());
}


3) delete from stuff where id = 1;


4) select * from stuff; <----------this takes 2-3 seconds.
Reply With Quote
  #2 (permalink)  
Old 04-17-09, 10:23
varunragul varunragul is offline
Registered User
 
Join Date: Apr 2009
Posts: 1
The Problem is not with Where clause Query or anything , with Sql server itself.

do this u willl find the answer by yourself

after u delete the table Check with Sp_spaceUSed 'tablename'

even after deleting u will find pages not deallcoated , the page will exists

do the same with Truncate and see.

Hope u get it know .
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On