Achilleas
Achilleas2w ago

Any siggestions on how to reduce

Any siggestions on how to reduce database bandwidth usage?
5 Replies
Hmza
Hmza2w ago
Can you check your dashboard to see which function is taking the most bandwidth from there you can practice to always use Indexes and if using .collect() then always use pagination instead.
Achilleas
AchilleasOP2w ago
This is from the dashboard. Apparently the movie list is the biggest eater. I do use this, which I suppose is what's eating all the bandwidth:
// 1. Get all movies
const movies = await ctx.db.query("movies").collect();

// 2. Get all showings
const allShowings = await ctx.db.query("showings").collect();
// 1. Get all movies
const movies = await ctx.db.query("movies").collect();

// 2. Get all showings
const allShowings = await ctx.db.query("showings").collect();
No description
Achilleas
AchilleasOP2w ago
But say I want all movies to be shown at once, do you think I should still use pagination?
Hmza
Hmza2w ago
How many movies are there ?
Achilleas
AchilleasOP2w ago
~300 movies, with ~200 cinemas, and ~600 showtimes

Did you find this page helpful?