forked from wangziqi/gongxue-base
19 lines
877 B
SQL
19 lines
877 B
SQL
create index if not exists idx_practice_sessions_user_started
|
|
on public.practice_sessions(tenant_id, user_id, started_at desc);
|
|
|
|
create index if not exists idx_practice_sessions_user_finished
|
|
on public.practice_sessions(tenant_id, user_id, finished_at desc)
|
|
where finished_at is not null;
|
|
|
|
create index if not exists idx_answer_records_user_answered
|
|
on public.answer_records(tenant_id, user_id, answered_at desc);
|
|
|
|
create index if not exists idx_answer_records_session_latest
|
|
on public.answer_records(tenant_id, user_id, practice_session_id, question_id, answered_at desc);
|
|
|
|
create index if not exists idx_wrong_questions_user_review
|
|
on public.wrong_questions(tenant_id, user_id, resolved_at, last_wrong_at desc, wrong_count desc);
|
|
|
|
create index if not exists idx_favorite_questions_user_created
|
|
on public.favorite_questions(tenant_id, user_id, created_at desc);
|