Skip to content

Commit

Permalink
Read partition information only when it is explicitly requested for I…
Browse files Browse the repository at this point in the history
…_S queries

Summary: Read partition information only when it is explicitly requested for I_S queries

Test Plan: Jenkins

Reviewers: ebergen, tianx, santoshb

Reviewed By: ebergen, tianx, santoshb
  • Loading branch information
pengtfb authored and jtolmer committed Jan 5, 2016
1 parent de7ae77 commit 33ee13e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sql/sql_show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6136,7 +6136,24 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
CHARSET_INFO *cs= system_charset_info;
PARTITION_STATS stat_info;
MYSQL_TIME time;
file->get_dynamic_partition_info(&stat_info, part_id);

bool need_partition_info = false;
/* 12..21 are fields populated by table statistics (TABLE_ROWS..CHECKSUM)
*
* Addition of any fields in this function needs to match this check
*/
for (int f=12; f<=21; f++) {
if (bitmap_is_set(table->read_set, f)) {
need_partition_info = true;
break;
}
}

if (need_partition_info)
file->get_dynamic_partition_info(&stat_info, part_id);
else
memset(&stat_info, 0, sizeof(stat_info));

table->field[0]->store(STRING_WITH_LEN("def"), cs);
table->field[12]->store((longlong) stat_info.records, TRUE);
table->field[13]->store((longlong) stat_info.mean_rec_length, TRUE);
Expand Down

0 comments on commit 33ee13e

Please sign in to comment.