Tag Archives: speed

Virtualbox bridged network adapter driver slows down LAN speed

When I upgraded from WiFi to a physical CAT5E cable running between my router in the other room and this desktop, I jumped from 2-3MB/s tops (1MB/s usually, sometimes less) to 11-12MB/s speeds during file transfers from my home server.

Lately I was checking that the speed to download some fansubs off the server got down to 5-6MB/s, exactly half of what I was used to; I noticed there was another non specified adapter listed in Windows 7’s statusbar icon hover, and I traced it to Virtualbox’s bridged network adapter. Since I recently had installed that to test something for which I had no need anymore, I simply uninstalled Virtualbox, and as soon as the virtual network card driver was gone, speeds were back to 11-12MB/s.

Should this be in any way a normal behaviour?

MySQL SELECT query with more WHERE conditions runs faster

For some reason I wanted to add more redundant conditions to a WHERE clause in a MySQL SELECT query, but I feared that, being redundant conditions, I may end up slowing up the query.

Shortly, there is this classifieds site, where each item’s table has the town_id, province_id and region_id rows. If you know the town_id you’re looking for already, you can query:

SELECT * FROM items WHERE town_id='12'

instead of:

SELECT * FROM items WHERE town_id='12' AND province_id='34' AND region_id='56'

as the results will be the same… but should you?

I prepared a quick test panel:

$creationstart=strtok(microtime()," ")+strtok(" ");
 $test=doquery("SELECT * FROM items WHERE town_id='58003'");
$creationend=strtok(microtime()," ")+strtok(" ");
echo "town only: $creationtime<br />";

$creationstart=strtok(microtime()," ")+strtok(" ");
 $test=doquery("SELECT * FROM items WHERE town_id='58003' AND province_id='58' AND region_id='12'");
$creationend=strtok(microtime()," ")+strtok(" ");
echo "all conditions: $creationtime<br />";

Surprisingly, it took anywhere from 2.4s to 4.5s for the “all conditions” routine to complete, while the “town only” query ended up being about 0.4s slower. At first I thought it might be the MySQL cache in action, but even inverting the position of the cycles inside the code, results were the same.

So well, even if it looks redundant to you, adding more WHERE ... AND ... clauses in your query speeds up the fetching of the results.

  This article has been Digiproved