Entry Count plugin performance / template optimisation I'm using Ben Croker's Entry Count plugin in my News channel but have noticed a huge performance hit, I know its probably down to how I am loading the entries in to my template so I am looking for some help on that please. 

The News Channel where it is being used has tens of thousands of entries.

The server logs highlighted this query https://pastebin.com/02uF0Mat taking up to 3 minutes to complete, therefore maxing the CPU and crashing the site.

My template code:

{% cache globally using key "trending-news" %}                                  
    {% set countedEntries = craft.entryCount.entries.section('news').limit(4) %}

    {% for entry in countedEntries %}                       
        &lt;p&gt;{{ entry.postDate.format('jS F Y') }}&lt;br/&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }} &lt;/a&gt;&lt;/p&gt;                       
    {% endfor %}
{% endcache %}


So I think this code is loading thousands of news entries and then displaying only 4, is there a way I can just load the top 4 only? 

Massive thanks in advance!
This is untested since I don't have time to load the plugin, so please comment if there is a syntax error but changing this

// get all records from DB ordered by count descending
$entryCountRecords = EntryCountRecord::model()-&gt;findAll(array(
    'order'=&gt;'count desc'
));


To something like the following should work

public function getEntries($limit = null)
{
    $where = [
        'order' =&gt; 'count desc' 
    ];
    if($limit !== null){
        $where['limit'] = $limit;
    }
    // get all records from DB ordered by count descending
    $entryCountRecords = EntryCountRecord::model()-&gt;findAll($where);
   ....


And in your template

{% set countedEntries = craft.entryCount.entries(4).section('news').limit(4) %}


Explanation: you include a limit to the query that fetches all entries to load the same amount like the ElementCriteriaModel 

Edit: Maybe you have to change this to

public function getEntries($limit = null)
{
    return craft()-&gt;entryCount-&gt;getEntries($limit);
}