Documentation Home
MySQL Internals Manual
Download this Manual
EPUB - 1.2Mb


23.18.17 info

Purpose

Prompts storage engine to report statistics.

Synopsis

virtual int info (

flag);

uint

flag ;

Description

This is the info method.

info() is used to return information to the optimizer. Currently, this table handler doesn't implement most of the fields really needed. SHOW also makes use of this data Another note, you will probably want to have the following in your code:

if (records < 2) records = 2

The reason is that the server will optimize for cases of only a single record. If in a table scan you don't know the number of records it will probably be better to set records to two so you can return as many records as you need. Along with records a few more variables you may wish to set are: records deleted data_file_length index_file_length delete_length check_time See public variables in handler.h for more information.

Called in: filesort.cc ha_heap.cc item_sum.cc opt_sum.cc sql_delete.cc sql_delete.cc sql_derived.cc sql_select.cc sql_select.cc sql_select.cc sql_select.cc sql_select.cc sql_show.cc sql_show.cc sql_show.cc sql_show.cc sql_table.cc sql_union.cc sql_update.cc

Parameters

  • flag

Return Values

0 for if no error occurred, HA_ERR_xxx if an error occurred.

Usage

This example is from the CSV storage engine:

int ha_tina::info(uint flag)
{
  DBUG_ENTER("ha_tina::info");
  /* This is a lie, but you don't want the optimizer to see zero or 1 */
  if (!records_is_known && stats.records < 2)
    stats.records= 2;
  DBUG_RETURN(0);
}

User Comments
Sign Up Login You must be logged in to post a comment.