Tests / stats/tests.py
TestStats::test_store_daily_stats_with_accounts
First seen 2 years, 11 months ago in 1cd3a8d
CI
github-actions:test
11 runs
Average
161 ms
median 137 ms
max 322 ms
max 322 ms
Phases
Setup 4 ms
Call 154 ms
Teardown 3 ms
Categories
Database 156 ms
App code 1 ms
Other (pytest, Unsampled, Libraries) 4 ms
104 database queries per run
Needs 0 KB of memory (max 0 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 7 hours ago ·
open run
call133 ms97.0%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:60 store_daily_stats()130 ms94.7%
store_daily_statsstats/models.py:20 ).count()79 ms57.3%
QuerySet.countdjango/db/models/query.py:67779 ms57.3%
Query.get_countdjango/db/models/sql/query.py:65779 ms57.3%
Query.get_aggregationdjango/db/models/sql/query.py:63975 ms54.9%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162567 ms49.1%
CursorWrapper.executedjango/db/backends/utils.py:7967 ms49.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9267 ms49.1%
CursorWrapper._executedjango/db/backends/utils.py:10567 ms49.1%
Cursor.executepsycopg/cursor.py:11367 ms49.1%
Connection.waitpsycopg/connection.py:49567 ms49.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:20645 ms32.7%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28645 ms32.7%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7843 ms31.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16126 ms4.7%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7933 ms2.3%
SQLCompiler.get_from_clausedjango/db/models/sql/compiler.py:11603 ms2.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5793 ms2.3%
Join.as_sqldjango/db/models/sql/datastructures.py:883 ms2.3%
DatabaseOperations.prepare_join_on_clausedjango/db/backends/postgresql/operations.py:4023 ms2.3%
ForeignKey.db_typedjango/db/models/fields/related.py:13093 ms2.3%
BigAutoField.rel_db_typedjango/db/models/fields/__init__.py:29772 ms1.2%
Field.__init__django/db/models/fields/__init__.py:2622 ms1.2%
Field.choicesdjango/db/models/fields/__init__.py:5902 ms1.2%
normalize_choicesdjango/utils/choices.py:752 ms1.2%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7682 ms1.2%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7962 ms1.2%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
WhereNode.as_sqldjango/db/models/sql/where.py:1512 ms1.2%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2432 ms1.2%
BuiltinLookup.process_lhsdjango/db/models/lookups.py:2352 ms1.2%
Lookup.process_lhsdjango/db/models/lookups.py:1092 ms1.2%
BaseExpression.resolve_expressiondjango/db/models/expressions.py:2972 ms1.2%
BaseExpression.copydjango/db/models/expressions.py:4442 ms1.2%
copy<stdlib>/copy.py:1002 ms1.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16502 ms1.2%
Query.get_aggregationdjango/db/models/sql/query.py:6463 ms2.3%
SQLCompiler.has_composite_fieldsdjango/db/models/sql/compiler.py:15503 ms2.3%
SQLCompiler.has_composite_fields.<locals>.<genexpr>django/db/models/sql/compiler.py:15503 ms2.3%
store_daily_statsstats/models.py:12 f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()39 ms28.1%
QuerySet.countdjango/db/models/query.py:67735 ms25.7%
Query.get_countdjango/db/models/sql/query.py:65735 ms25.7%
Query.get_aggregationdjango/db/models/sql/query.py:63934 ms24.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162524 ms17.5%
CursorWrapper.executedjango/db/backends/utils.py:7924 ms17.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9224 ms17.5%
CursorWrapper._executedjango/db/backends/utils.py:10524 ms17.5%
Cursor.executepsycopg/cursor.py:11324 ms17.5%
Connection.waitpsycopg/connection.py:49524 ms17.5%
BaseCursor._execute_genpsycopg/_cursor_base.py:20622 ms16.4%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28622 ms16.4%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7822 ms16.4%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16126 ms4.7%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7686 ms4.7%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:896 ms4.7%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:786 ms4.7%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3195 ms3.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16233 ms2.3%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:263 ms2.3%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3202 ms1.2%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2982 ms1.2%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms1.2%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4422 ms1.2%
Connection.cursorpsycopg/connection.py:2592 ms1.2%
䡽綋䣐疍M蕈瓀䡷쎉譈�赈嗨䷫䠀삅杴譈⭈赈謼襈䧆욉ퟨ§褀䳁즅䩴උঐ빁ꗨő女뿿䑶譈ꬽဎ䠀욉ᗿໂ譈鬽ဎ䠀�ᗿາ襌䣰쒃嬠幁썝ㅅ䗯�උ०빁ꘈő듫쇿襁첵쳌쳌쳌쳌쳌쳌쳌䡕偓襈ㇷ䣛喍뻰)쀱㯨䗰蔀瓀䠼綋ㇰ㇛M蕈瓀茪⼸ࢹ冦묁ꗨő�譈༽ဎ䠀욉ᗿฦ]皿䠊�荈ࣄ嵛ᅢ觀쳰쳌쳌䡕噁䡓 �襈ㇷ䣛喍뻨)쀱쏨䗯蔀瓀䡎綋䣨疍M蕈瓀䤺욉赈債䣿잉�䷵묀ꗨő삅ぴ譈贽ဍ䰀ᗿඤ]瞿(觀䣛�腈ꃄ�嬀幁썝薋ィ솉�女耀�멵䦨冥묁ꘈő�꣫쳌쳌䡕坁噁啁呁䡓�襉擶譈┄(�襈큅좉褆菋샡襁䇟䰿ⲍ䠑붉h襈觖薖hʼn䇞㞼�묀7�⥄菳㿣圏䣀붍p⤏灇⤏恇⤏假⤏䁇⤏ぇ⤏⁇⤏၇⤏뤇�襌䳮憎맨§䴀ⲍ䤯얁q왁e薀瓛䔔荁㿤襌䳶燨µ䄀ᒍ茟ূ셉Ϧ襍ᵴ섀۪赈債䣿붋hﯨ梄搀譈┄(�㭈큅ት腈飄�嬀屁嵁幁彁썝ᗨÂ찀쳌쳌䡕坁噁啁呁䡓䄘횉襈Ԩ庒ﻬ赌쁽ཁܩ䐆茿Ǹ�䄀풉셁ۤ⥅仦ⲍ䰦ノ藨梄䰀ノ襌䳦襄ﺔཁܨᄏ䠃쒃嬘屁嵁幁彁썝쳌쳌쳌쳌쳌쳌쳌䡕ދ젏ډ䞋༄览ц䞋༈览ࡆ䞋༌览ె䞋༐览၆썝쳌쳌䡕坁噁啁呁䡓�襉擶譈┄(�襈큅좉褆菋샡襁䇟䰿ⲍ䠑붉h襈觖㶖gʼn䇞㞼�묀7�⥄菳㿣圏䣀붍p⤏灇⤏恇⤏假⤏䁇⤏ぇ⤏⁇⤏၇⤏뤇�襌䳮憎裡¥䴀ⲍ䤯얁q왁e薀瓛䔔荁㿤襌䳶뇨³䤀䤃츏赁ἔ슃䴉璉䠆떍p譈䢽㳸g䡤ҋ⠥�䠀䔻痐䠒쒁�䅛䅜䅝䅞嵟쁒�쳌䡕坁噁啁呁䡓䄘힉襈ԨᙒH赌쁵ཁة읁၆쏒䐆茿Ǹ�䄀풉셁ۤ⥅仧ⲍ䰦編朼䰀襌䳦襄ﺌ譁༆览䄃䚋༄览у譁ࡆ젏䎉䄈䚋༌览ృ譁၆젏䎉䠐쒃嬘屁嵁幁彁썝쳌䡕坁噁啁呁䡓�襈䢍䧿ﺉ䡤ҋ⠥�䠀䖉䓐溍㇈䇛ﶃ྿쎒圏䳀붍pཁ䜩䅰⤏恇ཁ䜩䅐⤏䁇ཁ䜩䄰⤏⁇ཁ䜩䄐⤏䤇䤃츏襁맴�襌䣿횉襌ꑚ�왂▄p솀ۣ襌ᵴ䢈鶋h襌䣿�矨栏䇿ﶃ瞾䠌綍䢐�旨栏擿譈┄(�㭈큅ት腈飄�嬀屁嵁幁彁썝쿨¾찀쳌쳌쳌쳌쳌쳌쳌䡕ދ例༄࿈诉ࡗ쨏譄ేཁ䓈例䄐줏譄ᑗཁ䓊律䄘쬏羋༜觏褆ю嚉䐈䚉䐌争䐐嚉䐔庉褘᱾썝䡕ދ例༄࿈诉ࡗ쨏譄ేཁ䓈例䄐줏譄ᑗཁ诊켏ډ争褄ࡖ襄ె襄၎襄ᑖ纉崘쳃쳌쳌쳌쳌쳌䡕坁噁啁呁䡓Ę�襌삅䣿趉ﻈ펉襉䧶ノ䡤ҋ⠥�䠀䖉䓐掍䖐腁翼䇿鈏䣅붍ﻐº냔�ཌྷﺤ䤃䤃츏ཉ觏맛Ā�赈킽䣿떋ﻈ襈ꋈ�蓆퀝胿譈삝䇿万뒉䀭仿벉䠭䣿붍ﻐ襈븦ト腁综矿䠏붍p襈븎ト䡤ҋ⠥�䠀䔻痐䠒쒁Ę�䅛䅜䅝䅞嵟봨�쳌쳌쳌쳌䡕譈䠇例䠈젏䣉型䠐쨏譌ᡇཉ䳈例䤠줏譌<unknown file>2 ms1.2%
deconstructible.<locals>.decorator.<locals>.__new__django/utils/deconstruct.py:172 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:-12 ms1.2%
store_daily_statsstats/models.py:15 account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()6 ms4.7%
QuerySet.countdjango/db/models/query.py:6776 ms4.7%
Query.get_countdjango/db/models/sql/query.py:6576 ms4.7%
Query.get_aggregationdjango/db/models/sql/query.py:6395 ms3.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16123 ms2.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7933 ms2.3%
SQLCompiler.get_from_clausedjango/db/models/sql/compiler.py:11603 ms2.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
Join.as_sqldjango/db/models/sql/datastructures.py:882 ms1.2%
DatabaseOperations.prepare_join_on_clausedjango/db/backends/postgresql/operations.py:4022 ms1.2%
ForeignKey.db_typedjango/db/models/fields/related.py:13092 ms1.2%
BigAutoField.rel_db_typedjango/db/models/fields/__init__.py:29772 ms1.2%
Field.db_typedjango/db/models/fields/__init__.py:9182 ms1.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16252 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms1.2%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms1.2%
Query.get_aggregationdjango/db/models/sql/query.py:4712 ms1.2%
store_daily_statsstats/models.py:18 f"{lang.code}_posts": Post.objects.filter(6 ms4.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:876 ms4.7%
QuerySet.filterdjango/db/models/query.py:16766 ms4.7%
QuerySet._filter_or_excludedjango/db/models/query.py:16946 ms4.7%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:17046 ms4.7%
Query.add_qdjango/db/models/sql/query.py:16816 ms4.7%
Query._add_qdjango/db/models/sql/query.py:17136 ms4.7%
Query.build_filterdjango/db/models/sql/query.py:15773 ms2.3%
Query.setup_joinsdjango/db/models/sql/query.py:19892 ms1.2%
Query.setup_joinsdjango/db/models/sql/query.py:20022 ms1.2%
Query.joindjango/db/models/sql/query.py:11502 ms1.2%
Query.build_filterdjango/db/models/sql/query.py:15732 ms1.2%
Query.build_filterdjango/db/models/sql/query.py:15512 ms1.2%
Query.solve_lookup_typedjango/db/models/sql/query.py:13582 ms1.2%
Query.names_to_pathdjango/db/models/sql/query.py:18012 ms1.2%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:32 account = Account.objects.create(2 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet.createdjango/db/models/query.py:7362 ms1.2%
Model.savedjango/db/models/base.py:9042 ms1.2%
Model.save_basedjango/db/models/base.py:9962 ms1.2%
Model._save_tabledjango/db/models/base.py:11992 ms1.2%
Model._do_insertdjango/db/models/base.py:12512 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet._insertdjango/db/models/query.py:21412 ms1.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms1.2%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms1.2%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:58 AccountLookup.objects.create(account=account, language="python\n")2 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet.createdjango/db/models/query.py:7362 ms1.2%
Model.savedjango/db/models/base.py:9042 ms1.2%
Model.save_basedjango/db/models/base.py:9962 ms1.2%
Model._save_tabledjango/db/models/base.py:11992 ms1.2%
Model._do_insertdjango/db/models/base.py:12512 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet._insertdjango/db/models/query.py:21412 ms1.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
Estimated from 83 samples; phase durations are exact. Frames from pytest and pluggy are
hidden
.
Hot lines in your code
|
stats/models.py:20
).count()
store_daily_stats
· Database
|
79 ms |
|
stats/models.py:12
f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()
store_daily_stats
· Database
|
39 ms |
|
stats/models.py:15
account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()
store_daily_stats
· Database
|
6 ms |
|
stats/models.py:18
f"{lang.code}_posts": Post.objects.filter(
store_daily_stats
· Database
|
6 ms |
|
stats/tests.py:32
account = Account.objects.create(
TestStats.test_store_daily_stats_with_accounts
· Database
|
2 ms |
|
stats/tests.py:58
AccountLookup.objects.create(account=account, language="python\n")
TestStats.test_store_daily_stats_with_accounts
· Database
|
2 ms |
Fixtures
Exact setup time| _live_server_helper function | 0.08 ms |
| _template_string_if_invalid_marker function | 0.06 ms |
| _dj_autoclear_mailbox function | 0.05 ms |
| _django_db_marker function | 0.05 ms |
| _django_isolate_apps function | 0.05 ms |
| _django_set_urlconf function | 0.05 ms |
| _django_clear_site_cache function | 0.04 ms |
| monkeypatch function | 0.03 ms |
Database
104 queries · 77 ms
Repeated queries are usually N+1 lookups: fetch them once with select_related / prefetch_related (or selectinload).
44×
SELECT COUNT(*) AS "__count" FROM "accounts_accountlookup" WHERE UPPER("accounts_accountlookup"."language"::text) LIKE UPPER(%s)
44×
SELECT COUNT(*) AS "__count" FROM "posts_post" INNER JOIN "accounts_account" ON ("posts_post"."account_id" = "accounts_account"."id") INNER JOIN "accounts_accountlookup" ON ("accounts_account"."id" = "accounts_accountlookup"."account_id") WHERE UPPER("accounts_accountlookup"."language"::text) LIKE …
Biggest pieces of work
|
call test body
stats/tests.py:60
|
133 ms |
Reliability
12 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 12 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 7 hours ago | CI github-actions:test | passed | 137 ms | Profile |
| 16 hours ago | CI github-actions:test | passed | 79 ms | Profile |
| 22 hours ago | CI github-actions:test | passed | 173 ms | Profile |
| 1 week, 5 days ago | CI github-actions:test | passed | 140 ms | Profile |
| 2 weeks, 2 days ago | CI github-actions:test | passed | 121 ms | Profile |
| 2 weeks, 2 days ago | CI github-actions:test | passed | 112 ms | Profile |
| 2 weeks, 4 days ago | CI github-actions:test | passed | 128 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 83 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 245 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 224 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 322 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 113 ms | Run |