Create index on blob id columns

Summary

Create appropriate partition indexes on the newly added blobs.id column (!2566 (diffs)) to support efficient background migration processing and general query performance as mentioned in #1248 (comment 1877479379).:

My suggestion is that we create an index on id like so: CREATE INDEX idx_blobs_null_id ON blobs (id) WHERE id IS NULL. At first this will have no advantage over sequential scans, but as more rows get their ids populated, the partial index will shrink and the SELECT will get exponentially faster, allowing us to chew through the whole table without slowing down. Keep in mind, indexes always require overhead, and remember that whenever a row is updated, all indexes on a table must be updated as well. That means that essentially each batch will be a negligible amount slower on the UPDATE queries at first but overall each batch should take the same constant short-ish amount of time instead of getting slower and slower.

Problem

Without proper indexing, the new ID column won't provide the expected performance benefits for background migrations or queries.

Edited by SAhmed