Bug 999331: searching attachment data is very slow due to an unbounded select