Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  ...  /  The heap Directory

A.1.8 The heap Directory

The HEAP (MEMORY) table handler.

All the MySQL table handlers (that is, the handlers that MySQL itself produces) have files with similar names and functions. Thus, this (heap) directory contains a lot of duplication of the myisam directory (for the MyISAM table handler). Such duplicates have been marked with an "*" in the following list. For example, you will find that \heap\hp_extra.c has a close equivalent in the myisam directory (\myisam\mi_extra.c) with the same descriptive comment. (Some of the differences arise because HEAP has different structures. HEAP does not need to use the sort of B-tree indexing that ISAM and MyISAM use; instead there is a hash index. Most importantly, HEAP is entirely in memory. File-I/O routines lose some of their vitality in such a context.)

  • hp_block.c --- Read/write a block (that is, a page)

  • hp_clear.c --- Remove all records in the table

  • hp_close.c --- * close database

  • hp_create.c --- * create a table

  • hp_delete.c --- * delete a row

  • hp_extra.c --- * for setting options and buffer sizes when optimizing

  • hp_hash.c --- Hash functions used for saving keys

  • hp_info.c --- * Information about database status

  • hp_open.c --- * open database

  • hp_panic.c --- * the hp_panic routine, for shutdowns and flushes

  • hp_rename.c --- * rename a table

  • hp_rfirst.c --- * read first row through a specific key (very short)

  • hp_rkey.c --- * read record using a key

  • hp_rlast.c --- * read last row with same key as previously-read row

  • hp_rnext.c --- * read next row with same key as previously-read row

  • hp_rprev.c --- * read previous row with same key as previously-read row

  • hp_rrnd.c --- * read a row based on position

  • hp_rsame.c --- * find current row using positional read or key-based read

  • hp_scan.c --- * read all rows sequentially

  • hp_static.c --- * static variables (very short)

  • hp_test1.c --- * testing basic functions

  • hp_test2.c --- * testing database and storing results

  • hp_update.c --- * update an existing row

  • hp_write.c --- * insert a new row

There are fewer files in the heap directory than in the myisam directory, because fewer are necessary. For example, there is no need for a \myisam\mi_cache.c equivalent (to cache reads) or a \myisam\mi_log.c equivalent (to log statements).