# "SELECT COUNT(\*) FROM tbl WHERE score\>$score" Causing Excessive Load?

**URL:** <https://forum.kirupa.com/t/select-count-from-tbl-where-score-score-causing-excessive-load/237586>\
**Category:** programming\
**Created:** [August 31, 2007, 5:45pm UTC](https://forum.kirupa.com/t/select-count-from-tbl-where-score-score-causing-excessive-load/237586 "2007-08-31T17:45:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomazws](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tomazws](https://forum.kirupa.com/u/tomazws)\
**Post date:** [August 31, 2007, 5:45pm UTC](https://forum.kirupa.com/t/select-count-from-tbl-where-score-score-causing-excessive-load/237586/1 "2007-08-31T17:45:40Z")

</div>

MySQL v3.x  
PHP v4.x

I have a scoring table with almost 15,000 rows. Ranking a particular person is required.

I currently have this script to calculate the rank:

```php

$myScore = 233292;
$result = mysql_query("SELECT COUNT(*) as count FROM tbl WHERE score>$myScore");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
echo "You rank $row[count]."; // You rank 123422.

```

which… according to my web host, is causing excessive server load.

I’m wondering if there’s any other way to optimize it?

thanks!
