summaryrefslogtreecommitdiff
path: root/sql/ha_archive.cc
diff options
context:
space:
mode:
authorunknown <brian@zim.tangent.org>2006-01-12 20:32:40 -0800
committerunknown <brian@zim.tangent.org>2006-01-12 20:32:40 -0800
commit9eaf718af0de619dd6ace632d9f1df88e54566f3 (patch)
tree68ef3d13b167fbe599a750947c83cf180d47196f /sql/ha_archive.cc
parent14ff02d347198fa6d0add129936bd1fa6e426344 (diff)
downloadmariadb-git-9eaf718af0de619dd6ace632d9f1df88e54566f3.tar.gz
New support for ignoring blobs during scans. We now seek past them if we determine that they are of no use to us. This is a big save in tables with blobs. Far less memory overhead and the seek is quite a bit faster.
mysql-test/r/archive.result: New results mysql-test/t/archive.test: More tests for indexes and new tests for being selective on selects. sql/ha_archive.cc: We now look and see if blobs are needed, and if they are not, we seek past them.
Diffstat (limited to 'sql/ha_archive.cc')
-rw-r--r--sql/ha_archive.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc
index 81b3a4e2339..fea4005d131 100644
--- a/sql/ha_archive.cc
+++ b/sql/ha_archive.cc
@@ -170,6 +170,7 @@ handlerton archive_hton = {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
+ NULL, /* Alter interface */
HTON_NO_FLAGS
};
@@ -973,7 +974,10 @@ int ha_archive::get_row(azio_stream *file_to_read, byte *buf)
for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
ptr != end ;
ptr++)
- total_blob_length += ((Field_blob*) table->field[*ptr])->get_length();
+ {
+ if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr))
+ total_blob_length += ((Field_blob*) table->field[*ptr])->get_length();
+ }
/* Adjust our row buffer if we need be */
buffer.alloc(total_blob_length);
@@ -987,11 +991,18 @@ int ha_archive::get_row(azio_stream *file_to_read, byte *buf)
size_t size= ((Field_blob*) table->field[*ptr])->get_length();
if (size)
{
- read= azread(file_to_read, last, size);
- if ((size_t) read != size)
- DBUG_RETURN(HA_ERR_END_OF_FILE);
- ((Field_blob*) table->field[*ptr])->set_ptr(size, last);
- last += size;
+ if (ha_get_bit_in_read_set(((Field_blob*) table->field[*ptr])->fieldnr))
+ {
+ read= azread(file_to_read, last, size);
+ if ((size_t) read != size)
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ ((Field_blob*) table->field[*ptr])->set_ptr(size, last);
+ last += size;
+ }
+ else
+ {
+ (void)azseek(file_to_read, size, SEEK_CUR);
+ }
}
}
DBUG_RETURN(0);