Here is my template tag:

```
@register.filter
def split_to_4_columns(queryset):
    split = int(ceil(queryset.count()/4.))
    columns = list()
    for i in range(4):
        columns.append(queryset[i*split:(i+1)*split])
    return columns

```

And here is my pseudo usage in templates:

```
{% for column in queryset|split_to_4_columns %}
<div class="list">
    {% for object in column %}
    <a href="{{ object.get_absolute_url }}" class="item">{{ object }}</a>
    {% endfor %}
</div>
{% endfor %}

```

It basically splits my long querysets (few hundreds objects) into 4 columns for a better html presentation. But it also appears to hit hard on my database. First it evaluates the full queryset, and then every column gets it's own evaluation, how can I optimize it?

I am using caching, but still, I'd like to know how can I optimize it on a lower level than just caching.