PgHero

Queries

Total Time Average Time Calls
163,593 min 26% 4 ms 2,331,101,759 ankipro
SELECT "v2"."decks"."id" FROM "v2"."decks" WHERE ("v2"."decks"."ancestry" LIKE $1 OR "v2"."decks"."id" = $2) AND "v2"."decks"."state" != $3
35,338 min 6% 13 ms 168,524,274 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1) OR ancestry LIKE $2) AND state NOT IN ($3,$4,$5) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $6 AND frozen = $7 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
29,432 min 5% 424 ms 4,163,730 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."public_state" = $1 AND "v2"."decks"."ancestry" = $2 AND "v2"."decks"."sharing_token" = $3 LIMIT $4
21,938 min 3% 3 ms 471,390,772 ankipro
SELECT "v2"."card_progresses"."id", "v2"."card_progresses"."ease_factor", "v2"."card_progresses"."frozen", "v2"."card_progresses"."interval", "v2"."card_progresses"."learning_state", "v2"."card_progresses"."learning_steps_index", "v2"."card_progresses"."next_review_at", "v2"."card_progresses"."ordinal", "v2"."card_progresses"."raw_next_review_at", "v2"."card_progresses"."to_learn_in_current_sl_round", "v2"."card_progresses"."note_id", "v2"."card_progresses"."user_id", "v2"."card_progresses"."created_at", "v2"."card_progresses"."updated_at", "v2"."card_progresses"."fetch_priority", "v2"."card_progresses"."deck_id", "v2"."card_progresses"."undo_data" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."note_id" = $1 AND "v2"."card_progresses"."ordinal" = $2 AND "v2"."card_progresses"."user_id" = $3 LIMIT $4
Covered by index on (note_id)
Rows: 112354288
Row progression: 112354288, 0

Row estimates
- note_id (=): 0
- user_id (=): 769
- ordinal (=): 112354288

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
16,833 min 3% 3 ms 296,116,864 ankipro
SELECT "v2"."card_progresses"."note_id" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."deck_id" = $1 AND "v2"."card_progresses"."user_id" = $2 AND "v2"."card_progresses"."frozen" = $3
Covered by index on (deck_id, user_id, note_id)
Rows: 112354288
Row progression: 112354288, 272, 0

Row estimates
- deck_id (=): 272
- user_id (=): 769
- frozen (=): 56177144

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
16,482 min 3% 8 ms 126,511,569 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
15,664 min 2% 1 ms 843,354,321 ankipro
SELECT COUNT(id) AS total, SUM(CASE WHEN NOT frozen AND learning_state = $1 THEN $2 ELSE $3 END) AS new, SUM(CASE WHEN NOT frozen AND learning_state = $4 AND next_review_at < $5 THEN $6 ELSE $7 END) AS learning, SUM(CASE WHEN NOT frozen AND learning_state = $8 AND next_review_at < $9 THEN $10 ELSE $11 END) AS graduated, SUM(CASE WHEN NOT frozen AND learning_state = $12 THEN $13 ELSE $14 END) AS learning_total, SUM(CASE WHEN NOT frozen AND learning_state = $15 THEN $16 ELSE $17 END) AS graduated_total, SUM(CASE WHEN NOT frozen AND learning_state = $18 THEN $19 ELSE $20 END) AS study_again, SUM(CASE WHEN NOT frozen AND learning_state = $21 THEN $22 ELSE $23 END) AS got_it, SUM(CASE WHEN frozen THEN $24 ELSE $25 END) as frozen, SUM(CASE WHEN NOT frozen AND learning_state IN($26, $27, $28) AND next_review_at < $29 THEN $30 ELSE $31 END) as offline_available, MIN(CASE WHEN NOT frozen AND next_review_at > $32 THEN next_review_at ELSE $33 END) as recalculate_at FROM v2.card_progresses WHERE user_id = $34 AND deck_id IN ($35)
Covered by index on (deck_id, user_id, note_id)
Rows: 112354288
Row progression: 112354288, 272, 0

Row estimates
- deck_id (=): 272
- user_id (=): 769

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
13,550 min 2% 7 ms 109,432,291 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4, $5, $6, $7)
13,083 min 2% 0 ms 2,184,353,245 ankipro
SELECT "v2"."deck_counters"."id", "v2"."deck_counters"."recalculate_at", "v2"."deck_counters"."deck_id" FROM "v2"."deck_counters" WHERE "v2"."deck_counters"."deck_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) AND "v2"."deck_counters"."user_id" = $11
Covered by index on (deck_id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- deck_id (=): 1
- user_id (=): 446

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
10,720 min 2% 5 ms 131,610,163 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" = $1
10,245 min 2% 4 ms 137,722,407 ankipro
SELECT "v2"."decks"."id" FROM "v2"."decks" WHERE "v2"."decks"."state" != $1 AND "v2"."decks"."id" IN (SELECT "v2"."deck_settings"."deck_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."user_id" = $2 AND "v2"."deck_settings"."state" = $3)
9,496 min 1% 4 ms 135,799,181 ankipro
SELECT "v2"."decks"."id" FROM "v2"."decks" WHERE ("v2"."decks"."ancestry" LIKE $1 OR "v2"."decks"."id" = $2)
9,141 min 1% 2 ms 304,375,630 ankipro
SELECT "v2"."deck_settings"."deck_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."user_id" = $1 AND "v2"."deck_settings"."state" = $2
8,495 min 1% 4 ms 119,863,849 ankipro
SELECT "v2"."note_attachments"."attachment_id" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" = $1
8,105 min 1% 0 ms 1,253,271,759 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."id" = $1 LIMIT $2
Covered by index on (id)
Rows: 40038188
Row progression: 40038188, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
8,050 min 1% 1 ms 734,566,338 ankipro
SELECT DISTINCT "v2"."decks"."id" FROM "v2"."decks" INNER JOIN "v2"."deck_settings" ON "v2"."deck_settings"."deck_id" = "v2"."decks"."id" INNER JOIN "v2"."deck_counters" ON "v2"."deck_counters"."deck_id" = "v2"."decks"."id" WHERE ("v2"."decks"."state" IN ($1, $2, $3, $4, $5, $6) AND "v2"."decks"."public_state" = $7 OR "v2"."decks"."state" = $8 OR "v2"."decks"."state" = $9) AND (v2.deck_settings.user_id = $10 AND v2.deck_counters.user_id = $11) AND "v2"."decks"."id" = $12 LIMIT $13
7,019 min 1% 2 ms 184,827,011 ankipro
SELECT "v2"."deck_settings"."deck_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."user_id" = $1 AND "v2"."deck_settings"."folder_id" IS NULL
5,428 min 0.9% 9 ms 36,974,030 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50)
5,346 min 0.8% 30 ms 10,573,181 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4) OR ancestry LIKE $5 OR ancestry LIKE $6 OR ancestry LIKE $7 OR ancestry LIKE $8) AND state NOT IN ($9,$10,$11) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $12 AND frozen = $13 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
5,228 min 0.8% 20 ms 15,949,084 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2) OR ancestry LIKE $3 OR ancestry LIKE $4) AND state NOT IN ($5,$6,$7) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $8 AND frozen = $9 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
5,196 min 0.8% 26 ms 12,114,111 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3) OR ancestry LIKE $4 OR ancestry LIKE $5 OR ancestry LIKE $6) AND state NOT IN ($7,$8,$9) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $10 AND frozen = $11 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
5,052 min 0.8% 34 ms 8,929,965 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5) OR ancestry LIKE $6 OR ancestry LIKE $7 OR ancestry LIKE $8 OR ancestry LIKE $9 OR ancestry LIKE $10) AND state NOT IN ($11,$12,$13) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $14 AND frozen = $15 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
4,919 min 0.8% 5 ms 63,099,268 ankipro
SELECT $1 AS one FROM "v2"."decks" WHERE ("v2"."decks"."ancestry" LIKE $2 OR "v2"."decks"."id" = $3) AND "v2"."decks"."state" != $4 AND "v2"."decks"."state" IN ($5, $6, $7, $8, $9, $10) LIMIT $11
4,710 min 0.7% 0 ms 1,770,934,649 ankipro
UPDATE "users" SET "last_seen_time" = $1, "last_seen_ip" = $2, "country_code" = $3 WHERE "users"."id" = $4
Covered by index on (id)
Rows: 9011713
Row progression: 9011713, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- analytics_id
- country_code
- email varchar_pattern_ops
- id, timezone_offset
- locale, email WHERE (email IS NOT NULL) AND (onboarding_data IS NOT NULL) AND ((email)::text !~~ '%private%'::text)
- lower((email)::text)
- qon_id
- reset_password_token WHERE reset_password_token IS NOT NULL
- stripe_customer_id
- uid, provider UNIQUE
- username UNIQUE
4,638 min 0.7% 38 ms 7,379,783 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6) OR ancestry LIKE $7 OR ancestry LIKE $8 OR ancestry LIKE $9 OR ancestry LIKE $10 OR ancestry LIKE $11 OR ancestry LIKE $12) AND state NOT IN ($13,$14,$15) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $16 AND frozen = $17 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
4,178 min 0.7% 41 ms 6,152,029 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7) OR ancestry LIKE $8 OR ancestry LIKE $9 OR ancestry LIKE $10 OR ancestry LIKE $11 OR ancestry LIKE $12 OR ancestry LIKE $13 OR ancestry LIKE $14) AND state NOT IN ($15,$16,$17) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $18 AND frozen = $19 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
3,876 min 0.6% 18 ms 12,687,915 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."public_state" = $1 AND "v2"."decks"."ancestry" = $2 AND "v2"."decks"."visibility" IN ($3, $4) AND "v2"."decks"."slug" IS NOT NULL AND "v2"."decks"."library_deck_id" = $5 LIMIT $6
3,706 min 0.6% 43 ms 5,183,652 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8) OR ancestry LIKE $9 OR ancestry LIKE $10 OR ancestry LIKE $11 OR ancestry LIKE $12 OR ancestry LIKE $13 OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16) AND state NOT IN ($17,$18,$19) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $20 AND frozen = $21 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
3,331 min 0.5% 46 ms 4,390,619 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9) OR ancestry LIKE $10 OR ancestry LIKE $11 OR ancestry LIKE $12 OR ancestry LIKE $13 OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18) AND state NOT IN ($19,$20,$21) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $22 AND frozen = $23 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
3,123 min 0.5% 0 ms 496,354,161 ankipro
SELECT "v2"."deck_settings"."id", "v2"."deck_settings"."algorithm_preset", "v2"."deck_settings"."deck_id", "v2"."deck_settings"."easy_interval_minutes", "v2"."deck_settings"."easy_bonus_percent", "v2"."deck_settings"."font_settings", "v2"."deck_settings"."graduated_interval_minutes", "v2"."deck_settings"."interval_modifier_percent", "v2"."deck_settings"."last_sync_at", "v2"."deck_settings"."library_sharing", "v2"."deck_settings"."new_cards_per_day", "v2"."deck_settings"."reverse_mode", "v2"."deck_settings"."offline_mode", "v2"."deck_settings"."sharing", "v2"."deck_settings"."steps_in_minutes", "v2"."deck_settings"."shuffle_mode", "v2"."deck_settings"."tts_autoplay", "v2"."deck_settings"."tts", "v2"."deck_settings"."tts_back_side_language", "v2"."deck_settings"."tts_front_side_language", "v2"."deck_settings"."user_id", "v2"."deck_settings"."created_at", "v2"."deck_settings"."updated_at", "v2"."deck_settings"."position", "v2"."deck_settings"."tts_whole_card_pronunciation", "v2"."deck_settings"."state", "v2"."deck_settings"."max_cards_per_day", "v2"."deck_settings"."card_preset_id", "v2"."deck_settings"."max_interval_minutes", "v2"."deck_settings"."tts_speed", "v2"."deck_settings"."tts_slower_replay", "v2"."deck_settings"."folder_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."deck_id" = $1
Covered by index on (deck_id)
Rows: 40242168
Row progression: 40242168, 1

Row estimates
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id
- folder_id
- user_id
- user_id
3,047 min 0.5% 47 ms 3,872,865 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10) OR ancestry LIKE $11 OR ancestry LIKE $12 OR ancestry LIKE $13 OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20) AND state NOT IN ($21,$22,$23) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $24 AND frozen = $25 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
2,768 min 0.4% 50 ms 3,345,210 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11) OR ancestry LIKE $12 OR ancestry LIKE $13 OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22) AND state NOT IN ($23,$24,$25) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $26 AND frozen = $27 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
2,599 min 0.4% 1 ms 304,054,247 ankipro
UPDATE "v2"."deck_counters" SET "recalculate_at" = $1, "updated_at" = $2 WHERE "v2"."deck_counters"."id" = $3 AND "v2"."deck_counters"."deck_id" = $4
Covered by index on (id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- id (=): 1
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
2,589 min 0.4% 0 ms 429,085,009 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."id" = $1
Covered by index on (id)
Rows: 40038188
Row progression: 40038188, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
2,425 min 0.4% 0 ms 1,821,002,188 ankipro
SELECT "streaks"."id", "streaks"."duration", "streaks"."end_date", "streaks"."days_until_next_freeze" FROM "streaks" WHERE "streaks"."user_id" = $1
Covered by index on (user_id)
Rows: 5519656
Row progression: 5519656, 16

Row estimates
- user_id (=): 16

Existing indexes
- id PRIMARY
- user_id
- user_id, daterange(start_date, end_date, '[)'::text) GIST
- user_id WHERE end_date IS NULL UNIQUE
2,417 min 0.4% 51 ms 2,865,374 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12) OR ancestry LIKE $13 OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24) AND state NOT IN ($25,$26,$27) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $28 AND frozen = $29 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
2,288 min 0.4% 8 ms 16,281,023 ankipro
UPDATE "v2"."decks" SET "state" = $1 WHERE "v2"."decks"."ancestry" LIKE $2 AND "v2"."decks"."state" != $3
Details
CREATE INDEX CONCURRENTLY ON decks USING gist (ancestry gist_trgm_ops)
Rows: 40038188
Row progression: 40038188, 3391344

Row estimates
- ancestry (~~): 3391344
- state (<>): 32030550

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
2,223 min 0.3% 5 ms 24,372,591 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3)
2,194 min 0.3% 5 ms 24,506,784 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2)
2,135 min 0.3% 52 ms 2,442,318 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13) OR ancestry LIKE $14 OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26) AND state NOT IN ($27,$28,$29) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $30 AND frozen = $31 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
2,111 min 0.3% 0 ms 275,009,997 ankipro
UPDATE "v2"."deck_counters" SET "reviewed_today_count" = $1, "recalculate_at" = $2, "to_learn_today_count" = $3, "updated_at" = $4 WHERE "v2"."deck_counters"."id" = $5 AND "v2"."deck_counters"."deck_id" = $6
Covered by index on (id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- id (=): 1
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
1,924 min 0.3% 55 ms 2,113,928 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) OR ancestry LIKE $15 OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28) AND state NOT IN ($29,$30,$31) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $32 AND frozen = $33 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,914 min 0.3% 1 ms 106,686,799 ankipro
SELECT "v2"."card_progresses"."note_id", "v2"."card_progresses"."next_review_at", "v2"."card_progresses"."learning_state", "v2"."card_progresses"."frozen", "v2"."card_progresses"."ordinal" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."deck_id" = $1 AND "v2"."card_progresses"."note_id" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) AND "v2"."card_progresses"."user_id" = $22
Covered by index on (note_id)
Rows: 112354288
Row progression: 112354288, 0

Row estimates
- note_id (=): 0
- deck_id (=): 272
- user_id (=): 769

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
1,876 min 0.3% 58 ms 1,951,649 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) OR ancestry LIKE $16 OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30) AND state NOT IN ($31,$32,$33) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $34 AND frozen = $35 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,861 min 0.3% 0 ms 13,215,899,231 ankipro
SET application_name='/home/application/bundle/ruby/3.4.0/bin/rake'
1,823 min 0.3% 8 ms 13,781,504 ankipro
SELECT "v2"."notes"."id", "v2"."notes"."template_kind", "v2"."notes"."fields", "v2"."notes"."cards_count", "v2"."notes"."deck_id", "v2"."notes"."css" FROM "v2"."notes" WHERE "v2"."notes"."deck_id" = $1 AND "v2"."notes"."id" > $2 ORDER BY "v2"."notes"."id" ASC LIMIT $3
1,759 min 0.3% 0 ms 15,970,255,898 ankipro
SELECT $1 AS one FROM "solid_queue_ready_executions" WHERE "solid_queue_ready_executions"."queue_name" = $2 LIMIT $3 FOR UPDATE SKIP LOCKED
1,710 min 0.3% 0 ms 13,242,773,567 ankipro
SET application_name='/home/application/bundle/ruby/3.4.0/bin/pitchfork'
1,628 min 0.3% 6 ms 16,931,839 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4, $5)
1,611 min 0.3% 1 ms 180,690,371 ankipro
UPDATE "v2"."deck_counters" SET "recalculate_at" = $1 WHERE "v2"."deck_counters"."id" = $2 AND "v2"."deck_counters"."deck_id" = $3
Covered by index on (id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- id (=): 1
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
1,519 min 0.2% 0 ms 237,475,901 ankipro
SELECT "v2"."deck_settings"."id", "v2"."deck_settings"."algorithm_preset", "v2"."deck_settings"."deck_id", "v2"."deck_settings"."easy_interval_minutes", "v2"."deck_settings"."easy_bonus_percent", "v2"."deck_settings"."font_settings", "v2"."deck_settings"."graduated_interval_minutes", "v2"."deck_settings"."interval_modifier_percent", "v2"."deck_settings"."last_sync_at", "v2"."deck_settings"."library_sharing", "v2"."deck_settings"."new_cards_per_day", "v2"."deck_settings"."reverse_mode", "v2"."deck_settings"."offline_mode", "v2"."deck_settings"."sharing", "v2"."deck_settings"."steps_in_minutes", "v2"."deck_settings"."shuffle_mode", "v2"."deck_settings"."tts_autoplay", "v2"."deck_settings"."tts", "v2"."deck_settings"."tts_back_side_language", "v2"."deck_settings"."tts_front_side_language", "v2"."deck_settings"."user_id", "v2"."deck_settings"."created_at", "v2"."deck_settings"."updated_at", "v2"."deck_settings"."position", "v2"."deck_settings"."tts_whole_card_pronunciation", "v2"."deck_settings"."state", "v2"."deck_settings"."max_cards_per_day", "v2"."deck_settings"."card_preset_id", "v2"."deck_settings"."max_interval_minutes", "v2"."deck_settings"."tts_speed", "v2"."deck_settings"."tts_slower_replay", "v2"."deck_settings"."folder_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."deck_id" = $1 AND "v2"."deck_settings"."user_id" = $2
Covered by index on (deck_id)
Rows: 40242168
Row progression: 40242168, 1

Row estimates
- deck_id (=): 1
- user_id (=): 170

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id
- folder_id
- user_id
- user_id
1,519 min 0.2% 58 ms 1,568,581 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) OR ancestry LIKE $17 OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32) AND state NOT IN ($33,$34,$35) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $36 AND frozen = $37 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,512 min 0.2% 1 ms 92,289,305 ankipro
SELECT "v2"."decks"."id" AS t0_r0, "v2"."decks"."deck_collaborators_count" AS t0_r1, "v2"."decks"."deleted_by_user_at" AS t0_r2, "v2"."decks"."downvotes" AS t0_r3, "v2"."decks"."import_error_message" AS t0_r4, "v2"."decks"."name" AS t0_r5, "v2"."decks"."last_reset_at" AS t0_r6, "v2"."decks"."public_state" AS t0_r7, "v2"."decks"."sharing_token" AS t0_r8, "v2"."decks"."state" AS t0_r9, "v2"."decks"."visibility" AS t0_r10, "v2"."decks"."upvotes" AS t0_r11, "v2"."decks"."user_id" AS t0_r12, "v2"."decks"."created_at" AS t0_r13, "v2"."decks"."updated_at" AS t0_r14, "v2"."decks"."ancestry" AS t0_r15, "v2"."decks"."slug" AS t0_r16, "v2"."decks"."seo_description" AS t0_r17, "v2"."decks"."description" AS t0_r18, "v2"."decks"."category" AS t0_r19, "v2"."decks"."cloned_times_count" AS t0_r20, "v2"."decks"."is_indexable" AS t0_r21, "v2"."decks"."study_score" AS t0_r22, "v2"."decks"."library_deck_id" AS t0_r23, "v2"."decks"."file_hash" AS t0_r24, "v2"."decks"."cloned_from_id" AS t0_r25, "v2"."decks"."anki_deck_id" AS t0_r26, "v2"."decks"."studiers_count" AS t0_r27, "v2"."decks"."deck_id" AS t0_r28, "v2"."decks"."moved_at" AS t0_r29, "v2"."decks"."source" AS t0_r30, "v2"."decks"."reviews_count" AS t0_r31, "v2"."decks"."duplicated_from_id" AS t0_r32, "v2"."decks"."no_cards_limit" AS t0_r33, "v2"."decks"."category_id" AS t0_r34, "v2"."deck_settings"."id" AS t1_r0, "v2"."deck_settings"."algorithm_preset" AS t1_r1, "v2"."deck_settings"."deck_id" AS t1_r2, "v2"."deck_settings"."easy_interval_minutes" AS t1_r3, "v2"."deck_settings"."easy_bonus_percent" AS t1_r4, "v2"."deck_settings"."font_settings" AS t1_r5, "v2"."deck_settings"."graduated_interval_minutes" AS t1_r6, "v2"."deck_settings"."interval_modifier_percent" AS t1_r7, "v2"."deck_settings"."last_sync_at" AS t1_r8, "v2"."deck_settings"."library_sharing" AS t1_r9, "v2"."deck_settings"."new_cards_per_day" AS t1_r10, "v2"."deck_settings"."reverse_mode" AS t1_r11, "v2"."deck_settings"."offline_mode" AS t1_r12, "v2"."deck_settings"."sharing" AS t1_r13, "v2"."deck_settings"."steps_in_minutes" AS t1_r14, "v2"."deck_settings"."shuffle_mode" AS t1_r15, "v2"."deck_settings"."tts_autoplay" AS t1_r16, "v2"."deck_settings"."tts" AS t1_r17, "v2"."deck_settings"."tts_back_side_language" AS t1_r18, "v2"."deck_settings"."tts_front_side_language" AS t1_r19, "v2"."deck_settings"."user_id" AS t1_r20, "v2"."deck_settings"."created_at" AS t1_r21, "v2"."deck_settings"."updated_at" AS t1_r22, "v2"."deck_settings"."position" AS t1_r23, "v2"."deck_settings"."tts_whole_card_pronunciation" AS t1_r24, "v2"."deck_settings"."state" AS t1_r25, "v2"."deck_settings"."max_cards_per_day" AS t1_r26, "v2"."deck_settings"."card_preset_id" AS t1_r27, "v2"."deck_settings"."max_interval_minutes" AS t1_r28, "v2"."deck_settings"."tts_speed" AS t1_r29, "v2"."deck_settings"."tts_slower_replay" AS t1_r30, "v2"."deck_settings"."folder_id" AS t1_r31, "v2"."deck_counters"."id" AS t2_r0, "v2"."deck_counters"."deck_id" AS t2_r1, "v2"."deck_counters"."got_it_count" AS t2_r2, "v2"."deck_counters"."graduated_count" AS t2_r3, "v2"."deck_counters"."frozen_count" AS t2_r4, "v2"."deck_counters"."learning_count" AS t2_r5, "v2"."deck_counters"."new_count" AS t2_r6, "v2"."deck_counters"."presented_count" AS t2_r7, "v2"."deck_counters"."reviewed_today_count" AS t2_r8, "v2"."deck_counters"."recalculate_at" AS t2_r9, "v2"."deck_counters"."study_again_count" AS t2_r10, "v2"."deck_counters"."to_learn_today_count" AS t2_r11, "v2"."deck_counters"."to_review_count" AS t2_r12, "v2"."deck_counters"."total_new_count" AS t2_r13, "v2"."deck_counters"."user_id" AS t2_r14, "v2"."deck_counters"."created_at" AS t2_r15, "v2"."deck_counters"."updated_at" AS t2_r16, "v2"."deck_counters"."total_not_learned_count" AS t2_r17, "v2"."deck_counters"."offline_available_count" AS t2_r18, "v2"."deck_counters"."learning_total_count" AS t2_r19, "v2"."deck_counters"."graduated_total_count" AS t2_r20, "v2"."deck_counters"."finished_count" AS t2_r21 FROM "v2"."decks" INNER JOIN "v2"."deck_settings" ON "v2"."deck_settings"."deck_id" = "v2"."decks"."id" INNER JOIN "v2"."deck_counters" ON "v2"."deck_counters"."deck_id" = "v2"."decks"."id" WHERE ("v2"."decks"."state" IN ($1, $2, $3, $4, $5, $6) AND "v2"."decks"."public_state" = $7 OR "v2"."decks"."state" = $8 OR "v2"."decks"."state" = $9) AND (v2.deck_settings.user_id = $10 AND v2.deck_counters.user_id = $11) AND "v2"."decks"."id" = $12 AND "v2"."decks"."id" = $13
1,487 min 0.2% 1 ms 91,177,586 ankipro
SELECT "v2"."card_progresses"."id", "v2"."card_progresses"."ease_factor", "v2"."card_progresses"."frozen", "v2"."card_progresses"."interval", "v2"."card_progresses"."learning_state", "v2"."card_progresses"."learning_steps_index", "v2"."card_progresses"."next_review_at", "v2"."card_progresses"."ordinal", "v2"."card_progresses"."raw_next_review_at", "v2"."card_progresses"."to_learn_in_current_sl_round", "v2"."card_progresses"."note_id", "v2"."card_progresses"."user_id", "v2"."card_progresses"."created_at", "v2"."card_progresses"."updated_at", "v2"."card_progresses"."fetch_priority", "v2"."card_progresses"."deck_id", "v2"."card_progresses"."undo_data" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."id" IN ($1, $2, $3, $4, $5, $6, $7) AND "v2"."card_progresses"."deck_id" = $8 AND "v2"."card_progresses"."frozen" = $9
Covered by index on (id)
Rows: 112354288
Row progression: 112354288, 1

Row estimates
- id (=): 1
- deck_id (=): 272
- frozen (=): 56177144

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
1,463 min 0.2% 61 ms 1,431,985 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17) OR ancestry LIKE $18 OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34) AND state NOT IN ($35,$36,$37) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $38 AND frozen = $39 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,409 min 0.2% 0 ms 283,377,730 ankipro
SELECT "v2"."deck_counters"."id", "v2"."deck_counters"."recalculate_at", "v2"."deck_counters"."deck_id" FROM "v2"."deck_counters" WHERE "v2"."deck_counters"."deck_id" = $1 AND "v2"."deck_counters"."user_id" = $2
Covered by index on (deck_id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- deck_id (=): 1
- user_id (=): 446

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
1,407 min 0.2% 0 ms 240,593,638 ankipro
SELECT "v2"."notes"."id", "v2"."notes"."deck_id" FROM "v2"."notes" WHERE "v2"."notes"."deck_id" = $1 AND "v2"."notes"."id" = $2 LIMIT $3
1,318 min 0.2% 61 ms 1,294,483 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18) OR ancestry LIKE $19 OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36) AND state NOT IN ($37,$38,$39) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $40 AND frozen = $41 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,296 min 0.2% 6 ms 12,480,534 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4, $5, $6)
1,277 min 0.2% 1 ms 56,451,929 ankipro
SELECT "v2"."card_progresses"."id" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."deck_id" = $1 AND "v2"."card_progresses"."user_id" = $2 AND "v2"."card_progresses"."frozen" = $3 AND (v2.card_progresses.next_review_at <= $4 OR v2.card_progresses.next_review_at IS NULL) AND (v2.card_progresses.to_learn_in_current_sl_round = $5 OR v2.card_progresses.to_learn_in_current_sl_round IS NULL) AND (v2.card_progresses.id IN ($6,$7,$8)) ORDER BY CASE v2.card_progresses.learning_state WHEN $9 THEN $10 WHEN $11 THEN $12 ELSE $13 END ASC, CASE WHEN v2.card_progresses.fetch_priority = $14 THEN $15 ELSE $16 END, RANDOM() LIMIT $17
1,266 min 0.2% 6 ms 13,373,722 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" IN ($1, $2, $3, $4)
1,234 min 0.2% 66 ms 1,121,699 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20) OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40) AND state NOT IN ($41,$42,$43) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $44 AND frozen = $45 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,233 min 0.2% 1 ms 56,545,400 ankipro
SELECT "v2"."card_progresses"."id" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."deck_id" = $1 AND "v2"."card_progresses"."user_id" = $2 AND "v2"."card_progresses"."frozen" = $3 AND (v2.card_progresses.next_review_at <= $4 OR v2.card_progresses.next_review_at IS NULL) AND (v2.card_progresses.to_learn_in_current_sl_round = $5 OR v2.card_progresses.to_learn_in_current_sl_round IS NULL) AND (learning_state IN ($6,$7,$8)) AND (v2.card_progresses.id NOT IN ($9,$10,$11)) ORDER BY CASE v2.card_progresses.learning_state WHEN $12 THEN $13 WHEN $14 THEN $15 ELSE $16 END ASC, CASE WHEN v2.card_progresses.fetch_priority = $17 THEN $18 ELSE $19 END, RANDOM() LIMIT $20
1,183 min 0.2% 2 ms 40,210,470 ankipro
SELECT "v2"."attachments"."id", "v2"."attachments"."media_kind", "v2"."attachments"."height", "v2"."attachments"."width", "v2"."attachments"."media_file", "v2"."attachments"."deck_id", "v2"."attachments"."created_at", "v2"."attachments"."updated_at", "v2"."attachments"."answer_mask", "v2"."attachments"."question_mask", "v2"."attachments"."source", "v2"."attachments"."custom_file_url" FROM "v2"."attachments" WHERE "v2"."attachments"."id" = $1
1,181 min 0.2% 0 ms 167,022,693 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."public_state" = $1 AND "v2"."decks"."id" = $2 LIMIT $3
1,172 min 0.2% 67 ms 1,049,808 ankipro
SELECT DISTINCT "users"."id" AS alias_0, "users"."id" FROM "users" LEFT OUTER JOIN "subscriptions" ON "subscriptions"."user_id" = "users"."id" WHERE "subscriptions"."expires_at" < $1 AND "users"."id" > $2 ORDER BY "users"."id" ASC LIMIT $3
1,113 min 0.2% 62 ms 1,076,985 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) OR ancestry LIKE $20 OR ancestry LIKE $21 OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38) AND state NOT IN ($39,$40,$41) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $42 AND frozen = $43 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
1,107 min 0.2% 0 ms 168,537,869 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."id" = $1 AND "v2"."decks"."ancestry" = $2
Covered by index on (id)
Rows: 40038188
Row progression: 40038188, 1

Row estimates
- id (=): 1
- ancestry (=): 32

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
1,062 min 0.2% 17 ms 3,696,632 ankipro
SELECT "v2"."notes"."id", "v2"."notes"."template_kind", "v2"."notes"."fields", "v2"."notes"."cards_count", "v2"."notes"."deck_id", "v2"."notes"."css" FROM "v2"."notes" WHERE "v2"."notes"."deck_id" = $1 ORDER BY "v2"."notes"."id" ASC LIMIT $2
1,047 min 0.2% 5 ms 13,506,966 ankipro
SELECT $1 AS one FROM "v2"."decks" WHERE ("v2"."decks"."ancestry" LIKE $2 OR "v2"."decks"."id" = $3) AND "v2"."decks"."state" != $4 AND "v2"."decks"."state" IN ($5, $6, $7, $8) LIMIT $9
1,040 min 0.2% 2 ms 31,589,620 ankipro
SELECT "v2"."deck_settings"."deck_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."user_id" = $1 AND "v2"."deck_settings"."folder_id" = $2
1,026 min 0.2% 3 ms 22,760,483 ankipro
SELECT "v2"."card_progresses"."id", "v2"."card_progresses"."ease_factor", "v2"."card_progresses"."frozen", "v2"."card_progresses"."interval", "v2"."card_progresses"."learning_state", "v2"."card_progresses"."learning_steps_index", "v2"."card_progresses"."next_review_at", "v2"."card_progresses"."ordinal", "v2"."card_progresses"."raw_next_review_at", "v2"."card_progresses"."to_learn_in_current_sl_round", "v2"."card_progresses"."note_id", "v2"."card_progresses"."user_id", "v2"."card_progresses"."created_at", "v2"."card_progresses"."updated_at", "v2"."card_progresses"."fetch_priority", "v2"."card_progresses"."deck_id", "v2"."card_progresses"."undo_data" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."note_id" = $1 AND "v2"."card_progresses"."ordinal" = $2 AND "v2"."card_progresses"."user_id" = $3
Covered by index on (note_id)
Rows: 112354288
Row progression: 112354288, 0

Row estimates
- note_id (=): 0
- user_id (=): 769
- ordinal (=): 112354288

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
1,015 min 0.2% 1 ms 68,779,819 ankipro
SELECT COUNT(*) FROM "v2"."notes" WHERE "v2"."notes"."deck_id" = $1
1,005 min 0.2% 6 ms 10,888,981 ankipro
SELECT "v2"."notes"."id", "v2"."notes"."template_kind", "v2"."notes"."fields", "v2"."notes"."cards_count", "v2"."notes"."deck_id", "v2"."notes"."created_at", "v2"."notes"."updated_at", "v2"."notes"."library_note_id", "v2"."notes"."library_card_id", "v2"."notes"."anki_id", "v2"."notes"."css", "v2"."notes"."source" FROM "v2"."notes" WHERE "v2"."notes"."id" = $1 LIMIT $2
1,003 min 0.2% 64 ms 939,087 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21) OR ancestry LIKE $22 OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42) AND state NOT IN ($43,$44,$45) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $46 AND frozen = $47 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
999 min 0.2% 0 ms 146,815,220 ankipro
SELECT "v2"."deck_settings"."id", "v2"."deck_settings"."algorithm_preset", "v2"."deck_settings"."deck_id", "v2"."deck_settings"."easy_interval_minutes", "v2"."deck_settings"."easy_bonus_percent", "v2"."deck_settings"."font_settings", "v2"."deck_settings"."graduated_interval_minutes", "v2"."deck_settings"."interval_modifier_percent", "v2"."deck_settings"."last_sync_at", "v2"."deck_settings"."library_sharing", "v2"."deck_settings"."new_cards_per_day", "v2"."deck_settings"."reverse_mode", "v2"."deck_settings"."offline_mode", "v2"."deck_settings"."sharing", "v2"."deck_settings"."steps_in_minutes", "v2"."deck_settings"."shuffle_mode", "v2"."deck_settings"."tts_autoplay", "v2"."deck_settings"."tts", "v2"."deck_settings"."tts_back_side_language", "v2"."deck_settings"."tts_front_side_language", "v2"."deck_settings"."user_id", "v2"."deck_settings"."created_at", "v2"."deck_settings"."updated_at", "v2"."deck_settings"."position", "v2"."deck_settings"."tts_whole_card_pronunciation", "v2"."deck_settings"."state", "v2"."deck_settings"."max_cards_per_day", "v2"."deck_settings"."card_preset_id", "v2"."deck_settings"."max_interval_minutes", "v2"."deck_settings"."tts_speed", "v2"."deck_settings"."tts_slower_replay", "v2"."deck_settings"."folder_id" FROM "v2"."deck_settings" WHERE "v2"."deck_settings"."deck_id" = $1 AND "v2"."deck_settings"."user_id" = $2 LIMIT $3
Covered by index on (deck_id)
Rows: 40242168
Row progression: 40242168, 1

Row estimates
- deck_id (=): 1
- user_id (=): 170

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id
- folder_id
- user_id
- user_id
969 min 0.2% 8 ms 7,603,080 ankipro
SELECT notes.id, notes.deck_id, notes.template_kind, notes.fields, notes.cards_count, notes.css, notes.created_at, notes.source FROM v2.notes AS notes WHERE notes.deck_id IN ($1) ORDER BY notes.created_at DESC, notes.id DESC OFFSET $2 LIMIT $3
957 min 0.2% 0 ms 520,972,228 ankipro
UPDATE "users" SET "updated_at" = $1, "metadata" = $2 WHERE "users"."id" = $3
Covered by index on (id)
Rows: 9011713
Row progression: 9011713, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- analytics_id
- country_code
- email varchar_pattern_ops
- id, timezone_offset
- locale, email WHERE (email IS NOT NULL) AND (onboarding_data IS NOT NULL) AND ((email)::text !~~ '%private%'::text)
- lower((email)::text)
- qon_id
- reset_password_token WHERE reset_password_token IS NOT NULL
- stripe_customer_id
- uid, provider UNIQUE
- username UNIQUE
933 min 0.1% 66 ms 842,220 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22) OR ancestry LIKE $23 OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42 OR ancestry LIKE $43 OR ancestry LIKE $44) AND state NOT IN ($45,$46,$47) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $48 AND frozen = $49 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
911 min 0.1% 1 ms 71,305,461 ankipro
SELECT "v2"."card_progresses"."id" FROM "v2"."card_progresses" WHERE "v2"."card_progresses"."deck_id" = $1 AND "v2"."card_progresses"."user_id" = $2 AND "v2"."card_progresses"."frozen" = $3 AND (v2.card_progresses.next_review_at <= $4 OR v2.card_progresses.next_review_at IS NULL) AND (v2.card_progresses.to_learn_in_current_sl_round = $5 OR v2.card_progresses.to_learn_in_current_sl_round IS NULL) AND (learning_state IN ($6,$7,$8)) ORDER BY CASE v2.card_progresses.learning_state WHEN $9 THEN $10 WHEN $11 THEN $12 ELSE $13 END ASC, CASE WHEN v2.card_progresses.fetch_priority = $14 THEN $15 ELSE $16 END, RANDOM() LIMIT $17
896 min 0.1% 85 ms 635,823 ankipro
SELECT "v2"."decks"."id", "v2"."decks"."deck_collaborators_count", "v2"."decks"."deleted_by_user_at", "v2"."decks"."downvotes", "v2"."decks"."import_error_message", "v2"."decks"."name", "v2"."decks"."last_reset_at", "v2"."decks"."public_state", "v2"."decks"."sharing_token", "v2"."decks"."state", "v2"."decks"."visibility", "v2"."decks"."upvotes", "v2"."decks"."user_id", "v2"."decks"."created_at", "v2"."decks"."updated_at", "v2"."decks"."ancestry", "v2"."decks"."slug", "v2"."decks"."seo_description", "v2"."decks"."description", "v2"."decks"."category", "v2"."decks"."cloned_times_count", "v2"."decks"."is_indexable", "v2"."decks"."study_score", "v2"."decks"."library_deck_id", "v2"."decks"."file_hash", "v2"."decks"."cloned_from_id", "v2"."decks"."anki_deck_id", "v2"."decks"."studiers_count", "v2"."decks"."deck_id", "v2"."decks"."moved_at", "v2"."decks"."source", "v2"."decks"."reviews_count", "v2"."decks"."duplicated_from_id", "v2"."decks"."no_cards_limit", "v2"."decks"."category_id" FROM "v2"."decks" WHERE "v2"."decks"."user_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497, $498, $499, $500)
Covered by index on (user_id)
Rows: 40038188
Row progression: 40038188, 155

Row estimates
- user_id (=): 155

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
878 min 0.1% 2 ms 25,425,533 ankipro
SELECT COUNT(id) AS total, SUM(CASE WHEN NOT frozen AND learning_state = $1 THEN $2 ELSE $3 END) AS new, SUM(CASE WHEN NOT frozen AND learning_state = $4 AND next_review_at < $5 THEN $6 ELSE $7 END) AS learning, SUM(CASE WHEN NOT frozen AND learning_state = $8 AND next_review_at < $9 THEN $10 ELSE $11 END) AS graduated, SUM(CASE WHEN NOT frozen AND learning_state = $12 THEN $13 ELSE $14 END) AS learning_total, SUM(CASE WHEN NOT frozen AND learning_state = $15 THEN $16 ELSE $17 END) AS graduated_total, SUM(CASE WHEN NOT frozen AND learning_state = $18 THEN $19 ELSE $20 END) AS study_again, SUM(CASE WHEN NOT frozen AND learning_state = $21 THEN $22 ELSE $23 END) AS got_it, SUM(CASE WHEN frozen THEN $24 ELSE $25 END) as frozen, SUM(CASE WHEN NOT frozen AND learning_state IN($26, $27, $28) AND next_review_at < $29 THEN $30 ELSE $31 END) as offline_available, MIN(CASE WHEN NOT frozen AND next_review_at > $32 THEN next_review_at ELSE $33 END) as recalculate_at FROM v2.card_progresses WHERE user_id = $34 AND deck_id IN ($35,$36)
Covered by index on (deck_id, user_id, note_id)
Rows: 112354288
Row progression: 112354288, 272, 0

Row estimates
- deck_id (=): 272
- user_id (=): 769

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
837 min 0.1% 23 ms 2,209,392 ankipro
WITH cte AS ( SELECT id, deck_id, (sum(v2.notes.cards_count) over (order by v2.notes.id)) AS custom_offset FROM v2.notes WHERE $1=$2 AND v2.notes.id IN ($3) ORDER BY id ASC LIMIT $4 ) SELECT * FROM v2.notes AS notes INNER JOIN cte AS c ON c.id = notes.id AND c.deck_id = notes.deck_id AND c.custom_offset > $5 WHERE $6=$7 ORDER BY notes.id ASC LIMIT $8
821 min 0.1% 1 ms 74,483,351 ankipro
UPDATE "v2"."card_progresses" SET "ease_factor" = $1, "interval" = $2, "next_review_at" = $3, "raw_next_review_at" = $4, "updated_at" = $5, "undo_data" = $6 WHERE "v2"."card_progresses"."id" = $7 AND "v2"."card_progresses"."deck_id" = $8
Covered by index on (id)
Rows: 112354288
Row progression: 112354288, 1

Row estimates
- id (=): 1
- deck_id (=): 272

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
821 min 0.1% 66 ms 748,687 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) OR ancestry LIKE $24 OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42 OR ancestry LIKE $43 OR ancestry LIKE $44 OR ancestry LIKE $45 OR ancestry LIKE $46) AND state NOT IN ($47,$48,$49) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $50 AND frozen = $51 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
810 min 0.1% 0 ms 115,676,771 ankipro
UPDATE "v2"."deck_counters" SET "updated_at" = $1 WHERE "v2"."deck_counters"."id" = $2 AND "v2"."deck_counters"."deck_id" = $3
Covered by index on (id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- id (=): 1
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
784 min 0.1% 1 ms 72,157,140 ankipro
UPDATE "v2"."card_progresses" SET "interval" = $1, "next_review_at" = $2, "raw_next_review_at" = $3, "updated_at" = $4, "undo_data" = $5 WHERE "v2"."card_progresses"."id" = $6 AND "v2"."card_progresses"."deck_id" = $7
Covered by index on (id)
Rows: 112354288
Row progression: 112354288, 1

Row estimates
- id (=): 1
- deck_id (=): 272

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
782 min 0.1% 2 ms 29,821,366 ankipro
UPDATE "v2"."deck_counters" SET "recalculate_at" = $1 WHERE "v2"."deck_counters"."id" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11) AND "v2"."deck_counters"."deck_id" IN ($12, $13, $14, $15, $16, $17, $18, $19, $20, $21)
Covered by index on (id)
Rows: 40116112
Row progression: 40116112, 1

Row estimates
- id (=): 1
- deck_id (=): 1

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, user_id UNIQUE
- user_id
- user_id
752 min 0.1% 67 ms 672,962 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24) OR ancestry LIKE $25 OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42 OR ancestry LIKE $43 OR ancestry LIKE $44 OR ancestry LIKE $45 OR ancestry LIKE $46 OR ancestry LIKE $47 OR ancestry LIKE $48) AND state NOT IN ($49,$50,$51) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $52 AND frozen = $53 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
726 min 0.1% 0 ms 3,689,250,544 ankipro
SELECT $1 AS one FROM "subscriptions" WHERE "subscriptions"."user_id" = $2 AND (expires_at > $3) LIMIT $4
Covered by index on (user_id)
Rows: 220981
Row progression: 220981, 2

Row estimates
- user_id (=): 2
- expires_at (>): 12324

Existing indexes
- id PRIMARY
- product_id
- stripe_setup_intent_id UNIQUE
- user_id
722 min 0.1% 67 ms 642,582 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25) OR ancestry LIKE $26 OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42 OR ancestry LIKE $43 OR ancestry LIKE $44 OR ancestry LIKE $45 OR ancestry LIKE $46 OR ancestry LIKE $47 OR ancestry LIKE $48 OR ancestry LIKE $49 OR ancestry LIKE $50) AND state NOT IN ($51,$52,$53) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $54 AND frozen = $55 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
714 min 0.1% 5 ms 8,964,259 ankipro
SELECT "v2"."note_attachments"."id", "v2"."note_attachments"."note_id", "v2"."note_attachments"."deck_id", "v2"."note_attachments"."attachment_id", "v2"."note_attachments"."kind", "v2"."note_attachments"."created_at", "v2"."note_attachments"."updated_at", "v2"."note_attachments"."field_name" FROM "v2"."note_attachments" WHERE "v2"."note_attachments"."note_id" = $1 AND $2=$3
706 min 0.1% 4 ms 9,760,647 ankipro
SELECT COUNT(id) AS total, SUM(CASE WHEN NOT frozen AND learning_state = $1 THEN $2 ELSE $3 END) AS new, SUM(CASE WHEN NOT frozen AND learning_state = $4 AND next_review_at < $5 THEN $6 ELSE $7 END) AS learning, SUM(CASE WHEN NOT frozen AND learning_state = $8 AND next_review_at < $9 THEN $10 ELSE $11 END) AS graduated, SUM(CASE WHEN NOT frozen AND learning_state = $12 THEN $13 ELSE $14 END) AS learning_total, SUM(CASE WHEN NOT frozen AND learning_state = $15 THEN $16 ELSE $17 END) AS graduated_total, SUM(CASE WHEN NOT frozen AND learning_state = $18 THEN $19 ELSE $20 END) AS study_again, SUM(CASE WHEN NOT frozen AND learning_state = $21 THEN $22 ELSE $23 END) AS got_it, SUM(CASE WHEN frozen THEN $24 ELSE $25 END) as frozen, SUM(CASE WHEN NOT frozen AND learning_state IN($26, $27, $28) AND next_review_at < $29 THEN $30 ELSE $31 END) as offline_available, MIN(CASE WHEN NOT frozen AND next_review_at > $32 THEN next_review_at ELSE $33 END) as recalculate_at FROM v2.card_progresses WHERE user_id = $34 AND deck_id IN ($35,$36,$37,$38,$39,$40,$41,$42)
Covered by index on (deck_id, user_id, note_id)
Rows: 112354288
Row progression: 112354288, 272, 0

Row estimates
- deck_id (=): 272
- user_id (=): 769

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
703 min 0.1% 2 ms 23,350,787 ankipro
SELECT COUNT(id) AS total, SUM(CASE WHEN NOT frozen AND learning_state = $1 THEN $2 ELSE $3 END) AS new, SUM(CASE WHEN NOT frozen AND learning_state = $4 AND next_review_at < $5 THEN $6 ELSE $7 END) AS learning, SUM(CASE WHEN NOT frozen AND learning_state = $8 AND next_review_at < $9 THEN $10 ELSE $11 END) AS graduated, SUM(CASE WHEN NOT frozen AND learning_state = $12 THEN $13 ELSE $14 END) AS learning_total, SUM(CASE WHEN NOT frozen AND learning_state = $15 THEN $16 ELSE $17 END) AS graduated_total, SUM(CASE WHEN NOT frozen AND learning_state = $18 THEN $19 ELSE $20 END) AS study_again, SUM(CASE WHEN NOT frozen AND learning_state = $21 THEN $22 ELSE $23 END) AS got_it, SUM(CASE WHEN frozen THEN $24 ELSE $25 END) as frozen, SUM(CASE WHEN NOT frozen AND learning_state IN($26, $27, $28) AND next_review_at < $29 THEN $30 ELSE $31 END) as offline_available, MIN(CASE WHEN NOT frozen AND next_review_at > $32 THEN next_review_at ELSE $33 END) as recalculate_at FROM v2.card_progresses WHERE user_id = $34 AND deck_id IN ($35,$36,$37)
Covered by index on (deck_id, user_id, note_id)
Rows: 112354288
Row progression: 112354288, 272, 0

Row estimates
- deck_id (=): 272
- user_id (=): 769

Existing indexes
- id PRIMARY
- id, deck_id PRIMARY
- deck_id
- deck_id, id
- deck_id, user_id, note_id
- library_card_id
- library_note_id
- note_id
- user_id
- user_id, frozen
- user_id, id
- user_id, note_id
674 min 0.1% 2 ms 20,629,714 ankipro
SELECT COUNT(*) FROM "v2"."decks" WHERE "v2"."decks"."user_id" = $1
Covered by index on (user_id)
Rows: 40038188
Row progression: 40038188, 155

Row estimates
- user_id (=): 155

Existing indexes
- id PRIMARY
- id, user_id PRIMARY
- ancestry
- ancestry text_pattern_ops
- ancestry varchar_pattern_ops
- anki_deck_id
- category_id
- cloned_from_id
- deck_import_id
- deleted_by_user_at, user_id
- id, state
- library_deck_id
- public_state, visibility
- sharing_token varchar_pattern_ops UNIQUE
- state
- user_id
- user_id
669 min 0.1% 19 ms 2,059,644 ankipro
SELECT SUM("v2"."notes"."cards_count") FROM "v2"."notes" WHERE "v2"."notes"."deck_id" = $1
661 min 0.1% 68 ms 580,758 ankipro
WITH subtree_decks AS ( SELECT id, ancestry FROM v2.decks WHERE (id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26) OR ancestry LIKE $27 OR ancestry LIKE $28 OR ancestry LIKE $29 OR ancestry LIKE $30 OR ancestry LIKE $31 OR ancestry LIKE $32 OR ancestry LIKE $33 OR ancestry LIKE $34 OR ancestry LIKE $35 OR ancestry LIKE $36 OR ancestry LIKE $37 OR ancestry LIKE $38 OR ancestry LIKE $39 OR ancestry LIKE $40 OR ancestry LIKE $41 OR ancestry LIKE $42 OR ancestry LIKE $43 OR ancestry LIKE $44 OR ancestry LIKE $45 OR ancestry LIKE $46 OR ancestry LIKE $47 OR ancestry LIKE $48 OR ancestry LIKE $49 OR ancestry LIKE $50 OR ancestry LIKE $51 OR ancestry LIKE $52) AND state NOT IN ($53,$54,$55) ), min_next_reviews AS ( SELECT deck_id, MIN(next_review_at) AS min_next_review_at FROM v2.card_progresses WHERE deck_id IN (SELECT id FROM subtree_decks) AND user_id = $56 AND frozen = $57 GROUP BY deck_id ) SELECT sd.id AS deck_id, sd.ancestry, mn.min_next_review_at FROM subtree_decks sd LEFT JOIN min_next_reviews mn ON sd.id = mn.deck_id
659 min 0.1% 3 ms 12,803,562 ankipro
INSERT INTO "v2"."card_progresses" ("id","ease_factor","frozen","interval","learning_state","learning_steps_index","next_review_at","ordinal","raw_next_review_at","to_learn_in_current_sl_round","note_id","user_id","created_at","updated_at","fetch_priority","deck_id","undo_data") VALUES (nextval($1),$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17),(nextval($18),$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34),(nextval($35),$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51),(nextval($52),$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68),(nextval($69),$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85),(nextval($86),$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102),(nextval($103),$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119),(nextval($120),$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136),(nextval($137),$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153),(nextval($154),$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170),(nextval($171),$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187),(nextval($188),$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204),(nextval($205),$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221),(nextval($222),$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238),(nextval($239),$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255),(nextval($256),$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272),(nextval($273),$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289),(nextval($290),$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306),(nextval($307),$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323),(nextval($324),$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340),(nextval($341),$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357),(nextval($358),$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374),(nextval($375),$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391),(nextval($392),$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408),(nextval($409),$410,$411,$412,$413,$414,$415,$416,$417,$418,$419,$420,$421,$422,$423,$424,$425),(nextval($426),$427,$428,$429,$430,$431,$432,$433,$434,$435,$436,$437,$438,$439,$440,$441,$442),(nextval($443),$444,$445,$446,$447,$448,$449,$450,$451,$452,$453,$454,$455,$456,$457,$458,$459),(nextval($460),$461,$462,$463,$464,$465,$466,$467,$468,$469,$470,$471,$472,$473,$474,$475,$476),(nextval($477),$478,$479,$480,$481,$482,$483,$484,$485,$486,$487,$488,$489,$490,$491,$492,$493),(nextval($494),$495,$496,$497,$498,$499,$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$510),(nextval($511),$512,$513,$514,$515,$516,$517,$518,$519,$520,$521,$522,$523,$524,$525,$526,$527),(nextval($528),$529,$530,$531,$532,$533,$534,$535,$536,$537,$538,$539,$540,$541,$542,$543,$544),(nextval($545),$546,$547,$548,$549,$550,$551,$552,$553,$554,$555,$556,$557,$558,$559,$560,$561),(nextval($562),$563,$564,$565,$566,$567,$568,$569,$570,$571,$572,$573,$574,$575,$576,$577,$578),(nextval($579),$580,$581,$582,$583,$584,$585,$586,$587,$588,$589,$590,$591,$592,$593,$594,$595),(nextval($596),$597,$598,$599,$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$610,$611,$612),(nextval($613),$614,$615,$616,$617,$618,$619,$620,$621,$622,$623,$624,$625,$626,$627,$628,$629),(nextval($630),$631,$632,$633,$634,$635,$636,$637,$638,$639,$640,$641,$642,$643,$644,$645,$646),(nextval($647),$648,$649,$650,$651,$652,$653,$654,$655,$656,$657,$658,$659,$660,$661,$662,$663),(nextval($664),$665,$666,$667,$668,$669,$670,$671,$672,$673,$674,$675,$676,$677,$678,$679,$680),(nextval($681),$682,$683,$684,$685,$686,$687,$688,$689,$690,$691,$692,$693,$694,$695,$696,$697),(nextval($698),$699,$700,$701,$702,$703,$704,$705,$706,$707,$708,$709,$710,$711,$712,$713,$714),(nextval($715),$716,$717,$718,$719,$720,$721,$722,$723,$724,$725,$726,$727,$728,$729,$730,$731),(nextval($732),$733,$734,$735,$736,$737,$738,$739,$740,$741,$742,$743,$744,$745,$746,$747,$748),(nextval($749),$750,$751,$752,$753,$754,$755,$756,$757,$758,$759,$760,$761,$762,$763,$764,$765),(nextval($766),$767,$768,$769,$770,$771,$772,$773,$774,$775,$776,$777,$778,$779,$780,$781,$782),(nextval($783),$784,$785,$786,$787,$788,$789,$790,$791,$792,$793,$794,$795,$796,$797,$798,$799),(nextval($800),$801,$802,$803,$804,$805,$806,$807,$808,$809,$810,$811,$812,$813,$814,$815,$816),(nextval($817),$818,$819,$820,$821,$822,$823,$824,$825,$826,$827,$828,$829,$830,$831,$832,$833),(nextval($834),$835,$836,$837,$838,$839,$840,$841,$842,$843,$844,$845,$846,$847,$848,$849,$850) RETURNING "id"