diff options
author | unknown <mskold@mysql.com> | 2004-09-20 21:03:09 +0200 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2004-09-20 21:03:09 +0200 |
commit | 7d6860a73501973368e12b58c6506b63799dd7c0 (patch) | |
tree | 172f2c32502a597f2c7f21ce9890b0b878c39387 | |
parent | ca65afeb72e7f514d51b7dcf2cc49e85a3b92677 (diff) | |
download | mariadb-git-7d6860a73501973368e12b58c6506b63799dd7c0.tar.gz |
Added support for calculating index cadinality
-rw-r--r-- | sql/ha_ndbcluster.cc | 25 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 1 |
2 files changed, 22 insertions, 4 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index da32476ae74..96fcc99d3b9 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -166,9 +166,19 @@ struct Ndb_table_local_info { ha_rows records; }; +void ha_ndbcluster::set_rec_per_key() +{ + DBUG_ENTER("ha_ndbcluster::get_status_const"); + for (uint i=0 ; i < table->keys ; i++) + { + table->key_info[i].rec_per_key[table->key_info[i].key_parts-1]= 1; + } + DBUG_VOID_RETURN; +} + void ha_ndbcluster::records_update() { - DBUG_ENTER("ha_ndbcluster::records_update"); + DBUG_ENTER("ha_ndbcluster::get_status_variable"); struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info; DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d", ((const NDBTAB *)m_table)->getTableId(), @@ -2380,13 +2390,16 @@ void ha_ndbcluster::info(uint flag) DBUG_PRINT("info", ("HA_STATUS_NO_LOCK")); if (flag & HA_STATUS_TIME) DBUG_PRINT("info", ("HA_STATUS_TIME")); - if (flag & HA_STATUS_CONST) - DBUG_PRINT("info", ("HA_STATUS_CONST")); if (flag & HA_STATUS_VARIABLE) { DBUG_PRINT("info", ("HA_STATUS_VARIABLE")); records_update(); } + if (flag & HA_STATUS_CONST) + { + DBUG_PRINT("info", ("HA_STATUS_CONST")); + set_rec_per_key(); + } if (flag & HA_STATUS_ERRKEY) { DBUG_PRINT("info", ("HA_STATUS_ERRKEY")); @@ -3432,6 +3445,7 @@ ha_ndbcluster::~ha_ndbcluster() int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) { + int res; KEY *key; DBUG_ENTER("open"); DBUG_PRINT("enter", ("name: %s mode: %d test_if_locked: %d", @@ -3458,8 +3472,11 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) free_share(m_share); m_share= 0; DBUG_RETURN(HA_ERR_NO_CONNECTION); } + res= get_metadata(name); + if (!res) + info(HA_STATUS_VARIABLE | HA_STATUS_CONST); - DBUG_RETURN(get_metadata(name)); + DBUG_RETURN(res); } diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index a25d3e18310..cf7c91c4bbd 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -258,6 +258,7 @@ class ha_ndbcluster: public handler uint32 blobs_buffer_size; uint dupkey; + void set_rec_per_key(); void records_update(); void no_uncommitted_rows_execute_failure(); void no_uncommitted_rows_update(int); |