-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transparent pagination to query tabs, also limit result size.
Previously a query with 1M result rows would evaluate all 1M rows and only afterwards trim to the number displayed per page (1000 by default). This fixes the performance issue by applying a LIMIT to a wrapped version of the query, and perhaps redundantly, also using the fetchmany() API instead of fetchall(). Since we were in there, we added transparent pagination as well, and a new configuration option to set the results-per-page on the query tabs. Fixes #153
- Loading branch information
Showing
5 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<nav> | ||
<form action="." method="post"> | ||
<input name="ordering" type="hidden" value="{% if ordering %}{{ ordering }}{% endif %}" /> | ||
<input name="sql" type="hidden" value="{{ sql|default('') }}" /> | ||
<ul class="pagination"> | ||
<li class="{% if page < 2 %}disabled {% endif %}page-item"> | ||
<button class="page-link" name="page" type="submit" value="1">«</a> | ||
</li> | ||
<li class="{% if page < 2 %}disabled {% endif %}page-item"> | ||
<button class="page-link" name="page" type="submit" value="{{ page_prev }}">‹</a> | ||
</li> | ||
<li class="page-item disabled"> | ||
<span class="page-link">Page {{ page }} of {{ total_pages }}</span> | ||
</li> | ||
<li class="{% if page >= total_pages %}disabled {% endif %}page-item"> | ||
<button class="page-link" name="page" type="submit" value="{{ page_next }}">›</a> | ||
</li> | ||
<li class="{% if page >= total_pages %}disabled {% endif %}page-item"> | ||
<button class="page-link" name="page" type="submit" value="{{ total_pages }}">»</a> | ||
</li> | ||
</ul> | ||
</form> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters