healthkit-to-sqlite icon indicating copy to clipboard operation
healthkit-to-sqlite copied to clipboard

Add index on workout_points.date

Open simonw opened this issue 3 years ago • 2 comments

Sorting that by date makes sense for seeing most recent points, and my DB has 2.5m points in so it's an expensive sort!

simonw avatar Aug 20 '21 01:08 simonw

Workaround:

sqlite-utils create-index healthkit.db workout_points -- -date

See https://sqlite-utils.datasette.io/en/stable/cli.html#creating-indexes

simonw avatar Aug 20 '21 01:08 simonw

Also on workout_points.workout_id to speed up queries to show all points in a specific workout.

simonw avatar Aug 20 '21 01:08 simonw