explain analyze to find indexes is a hassle

I'm sure I'm missing something, but is there not an easier way to get my queries EXPLAIN ANALYZE'd ? Logging the queries includes dollar signs to be interoplated, so they cannot be EXPLAINed directly. What I'm really after is a helper to tell me what indexes I need.
1 Reply
Peit
Peit2w ago
i use drizzle studio to run it: db.execute(sql`EXPLAIN ANALYZE ${db.select().from(users).limit(10).getSQL()}`) can also ofc run in in your code base. got the idea from someone on GH who also did that: https://github.com/drizzle-team/drizzle-orm/issues/2498#issuecomment-2302586855

Did you find this page helpful?