stackedandflowed
stackedandflowed

Reputation: 61

Update MySQL DB to Compress Blobs

If there a one-shot way to update a range of IDs (e.g. WHERE ID>10 AND ID<1000) to compress a blob column (e.g. data)?

e.g.

UPDATE `table` SET `data`=(SELECT COMPRESS(`data`) FROM `table` WHERE ID=1) WHERE ID=1

but for a range of IDs instead of a single ID. I need to update around 1500 rows that were incorrectly inserted into a DB without compression.

Upvotes: 1

Views: 1106

Answers (1)

Sabeen Malik
Sabeen Malik

Reputation: 10880

Wont this work?:

UPDATE `table` SET `data`=  COMPRESS(`data`) WHERE ID > 10 AND ID < 1000

Upvotes: 5

Related Questions