diff options
author | unknown <monty@tik.mysql.com> | 2000-10-26 19:54:03 +0300 |
---|---|---|
committer | unknown <monty@tik.mysql.com> | 2000-10-26 19:54:03 +0300 |
commit | 3ae05104d091659ab27cba9a67651756e62ac124 (patch) | |
tree | f6c3faec12c4532f55979cba5e5e9b26f1bdb655 /sql/ha_berkeley.cc | |
parent | c0d6644b9653b2634e66d7cedf0f97340d51410a (diff) | |
download | mariadb-git-3ae05104d091659ab27cba9a67651756e62ac124.tar.gz |
Fixed bug with ORDER BY on BDB tables.
New benchmarks tests
sql-bench/test-insert.sh:
Added a lot of new ORDER BY tests
sql/filesort.cc:
Fix for big BDB tables
sql/ha_berkeley.cc:
A
sql/ha_berkeley.h:
A
sql/handler.h:
A
sql/sql_class.h:
Portability fix
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r-- | sql/ha_berkeley.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 1239c7db7d3..13306397fe1 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -25,8 +25,9 @@ We will need an updated Berkeley DB version for this. - Killing threads that has got a 'deadlock' - SHOW TABLE STATUS should give more information about the table. - - Get a more accurate count of the number of rows. - We could store the found number of rows when the table is scanned. + - Get a more accurate count of the number of rows (estimate_number_of_rows()). + We could store the found number of rows when the table is scanned and + then increment the counter for each attempted write. - We will need a manager thread that calls flush_logs, removes old logs and makes checkpoints at given intervals. - When not using UPDATE IGNORE, don't make a sub transaction but abort @@ -42,7 +43,6 @@ - LOCK TABLES - CHAR keys - BLOBS - - delete from t1; */ @@ -1297,7 +1297,7 @@ void ha_berkeley::info(uint flag) DBUG_ENTER("info"); if (flag & HA_STATUS_VARIABLE) { - records = HA_BERKELEY_ROWS_IN_TABLE; // Just to get optimisations right + records = estimate_number_of_rows(); // Just to get optimisations right deleted = 0; } else if (flag & HA_STATUS_ERRKEY) @@ -1607,4 +1607,20 @@ void ha_berkeley::update_auto_primary_key() pthread_mutex_unlock(&share->mutex); } +/* + Return an estimated of the number of rows in the table. + Used when sorting to allocate buffers and by the optimizer. +*/ + +ha_rows ha_berkeley::estimate_number_of_rows() +{ + ulonglong max_ident; + if (!hidden_primary_key) + return INT_MAX32; + pthread_mutex_lock(&share->mutex); + max_ident=share->auto_ident+EXTRA_RECORDS; + pthread_mutex_unlock(&share->mutex); + return (ha_rows) min(max_ident,(ulonglong) INT_MAX32); +} + #endif /* HAVE_BERKELEY_DB */ |