D1 latency very high for queries and API/wrangler

For Workes & Pages, what is the name of the domain?

What is the issue or error you’re encountering

Whenever I try to run a query or even a wrangler command against my D1 instance it is very slow.

What steps have you taken to resolve the issue?

I have tried running various queries and admin commands against the instance and they all take many seconds or minutes.

wrangler d1 info will often fail, or succeed but only after running for 2 minutes. Queries also take minutes or at best 10s of seconds. This database has 10 tables and 443 rows. it is brand new. I have other D1 instances and they are unaffected.

I am close to deleting and recreating it.

What are the steps to reproduce the issue?

wrangler d1 info

Update: I finally got a decent error from D1.

(error) [auth][cause]: Error: D1_ERROR: D1 is overloaded. Requests queued for too long.

This app is doing maybe 10s of requests. There’s only one person using it, me. All of the requests are basic CRUD and the columns are indexed. I’m not sure how I seem to deadlock it so much. Some of them are done by queries I don’t control from authjs but still that shouldn’t be a problem.

At this point I’m pretty sure the answer is, don’t use D1.

It’s definitely the authjs queries causing problems, BTW.

Hey @britt.v.crawford! I am encountering latency as well and am also using auth.js. Can you share more context on why you think it’s auth.js queries causing the issue? Do you have any other ideas besides migrating off the platform? Thanks!

My suspicion of authjs was based on the fact that it was login that seemed to trigger the outages. However it could have just been coincident timing with a larger system issue.

Interesting, thanks! FWIW, the latency I am experiencing is on both authjs tables and my own. Lots of queries against Session table, however, I have some moderately complex prisma statements that are taking upwards of 5s to complete running against my own tables.

I just disabled smart placement and noticed an uptick in performance in the last 10 minutes. Do you have the setting enabled for your project @britt.v.crawford?