List:General Discussion« Previous MessageNext Message »
From:Don Read Date:September 28 2000 9:52pm
Subject:Limit count (was:Re: How to detect EMPTY tables or NON-EXISTING tables ?)
View as plain text  
On 28-Sep-00 Jason Terry wrote:
> I really don't know for sure why...
> 
> But, the MySQL document located here
> http://www.mysql.com/information/presentations/presentation-oscon2000-20000719
> /index.html
> 
> Read the MySQL extensions/ optimizations section....
> 

Good info, thanks.

> But, I do know that it works, I have a query that does go faster when I use
> LIMIT


If so, I'd think you're seeing cache-ing in action;
let the table go idle for a while (or restart the server).

mysql> select count(*) from stats limit 0,1;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (1.29 sec)

mysql> select count(*) from stats limit 0,1;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.02 sec)

mysql> select count(*) from stats;          
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.01 sec)

mysql> select count(*) from hist_hits limit 0,1;
+----------+
| count(*) |
+----------+
|    83493 |
+----------+
1 row in set (1.48 sec)

mysql> select count(*) from hist_hits limit 0,1;
+----------+
| count(*) |
+----------+
|    83493 |
+----------+
1 row in set (0.02 sec)

mysql> select count(*) from hist_hits;          
+----------+
| count(*) |
+----------+
|    83493 |
+----------+
1 row in set (0.01 sec)


Regards,
-- 
Don Read                                         dread@stripped
--- The problem with people who have no vices is that you can be
        sure they're going to have some pretty annoying virtues.
Thread
How to detect EMPTY tables or NON-EXISTING tables ?Gildas PERROT28 Sep
  • RE: How to detect EMPTY tables or NON-EXISTING tables ?Don Read28 Sep
Re: How to detect EMPTY tables or NON-EXISTING tables ?Scott Kevill28 Sep
  • Re: How to detect EMPTY tables or NON-EXISTING tables ?Jason Terry28 Sep
    • Re: How to detect EMPTY tables or NON-EXISTING tables ?Don Read28 Sep
      • Re: How to detect EMPTY tables or NON-EXISTING tables ?Jason Terry28 Sep
        • Limit count (was:Re: How to detect EMPTY tables or NON-EXISTING tables ?)Don Read28 Sep