2323 (SELECT
2424 bucket,
2525 row_type,
26- sum(case when op = 3 and superseded = 0 then length(data) else 0 end) as data_size,
27- sum(length(row_type) + length(row_id) + length(bucket) + length(key) + 40) as metadata_size,
28- sum(case when op = 3 and superseded = 0 then 1 else 0 end) as row_count
29- FROM ps_oplog GROUP BY bucket, row_type),
26+ sum(length(ifnull(data, ''))) as data_size,
27+ sum(length(row_type) + length(row_id) + length(key) + 44) as metadata_size,
28+ count() as row_count
29+ FROM ps_oplog
30+ GROUP BY bucket, row_type),
3031
3132 oplog_stats AS
3233 (SELECT
33- bucket as name ,
34+ bucket as bucket_id ,
3435 sum(data_size) as data_size,
3536 sum(metadata_size) as metadata_size,
3637 sum(row_count) as row_count,
3738 json_group_array(row_type) tables
38- FROM oplog_by_table GROUP BY bucket)
39+ FROM oplog_by_table
40+ GROUP BY bucket)
3941
4042SELECT
4143 local.id as name,
@@ -47,10 +49,11 @@ SELECT
4749 local.total_operations,
4850 local.downloading
4951FROM local_bucket_data local
50- LEFT JOIN oplog_stats stats ON stats.name = local.id` ;
52+ LEFT JOIN ps_buckets ON ps_buckets.name = local.id
53+ LEFT JOIN oplog_stats stats ON stats.bucket_id = ps_buckets.id` ;
5154
5255const TABLES_QUERY = `
53- SELECT row_type as name, count() as count, sum(length(data)) as size FROM ps_oplog WHERE superseded = 0 and op = 3 GROUP BY row_type
56+ SELECT row_type as name, count() as count, sum(length(data)) as size FROM ps_oplog GROUP BY row_type
5457` ;
5558
5659const BUCKETS_QUERY_FAST = `
0 commit comments