Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ofw/django-explain
A helper to get EXPLAIN or EXPLAIN ANALYZE OUTPUT for django queryset.
https://github.com/ofw/django-explain
django python sql
Last synced: 27 days ago
JSON representation
A helper to get EXPLAIN or EXPLAIN ANALYZE OUTPUT for django queryset.
- Host: GitHub
- URL: https://github.com/ofw/django-explain
- Owner: ofw
- License: mit
- Created: 2016-08-29T15:37:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-02T13:45:10.000Z (over 8 years ago)
- Last Synced: 2024-04-29T18:09:07.880Z (8 months ago)
- Topics: django, python, sql
- Language: Python
- Size: 4.88 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - django-explain - A helper to get EXPLAIN or EXPLAIN ANALYZE OUTPUT for django queryset. (Python)
README
# Django-Explain - a helper to get EXPLAIN or EXPLAIN ANALYZE output for django queryset.
## Installation
```sh
pip install django-queryset
```## Example
```py
from django.contrib.auth.models import User
from django_explain import explainexplain_result = explain(User.objects.filter(pk=123))
explain_result.pretty_print()# SELECT "auth_user"."id",
# "auth_user"."password",
# "auth_user"."last_login",
# "auth_user"."is_superuser",
# "auth_user"."username",
# "auth_user"."first_name",
# "auth_user"."last_name",
# "auth_user"."email",
# "auth_user"."is_staff",
# "auth_user"."is_active",
# "auth_user"."date_joined",
# "auth_user"."has_orders"
# FROM "auth_user"
# WHERE "auth_user"."id" = 1
#
# Index Scan using auth_user_pkey on auth_user (cost=0.43..8.45 rows=1 width=1070) (actual time=0.039..0.039 rows=0 loops=1)
# Index Cond: (id = 1)
# Planning time: 1.203 ms
# Execution time: 0.106 msresult.get_depesz_url()
# https://explain.depesz.com/s/Tym
```