MySQL 9.1.0
Source Code Documentation
|
Unique – class for unique (removing of duplicates). More...
#include <uniques.h>
Public Member Functions | |
Unique (qsort2_cmp comp_func, void *comp_func_fixed_arg, uint size_arg, ulonglong max_in_memory_size_arg) | |
~Unique () | |
ulong | elements_in_tree () |
bool | unique_add (void *ptr) |
Add new value to Unique. More... | |
bool | get (TABLE *table) |
void | reset () |
bool | walk (tree_walk_action action, void *walk_action_arg) |
uint | get_size () const |
ulonglong | get_max_in_memory_size () const |
bool | is_in_memory () |
Static Public Member Functions | |
static double | get_use_cost (uint nkeys, uint key_size, ulonglong max_in_memory_size, const Cost_model_table *cost_model) |
Public Attributes | |
ulong | elements |
Private Member Functions | |
bool | flush () |
Flush tree to disk. More... | |
Private Attributes | |
Prealloced_array< Merge_chunk, 16 > | file_ptrs |
Array of file pointers. More... | |
ulong | max_elements |
Max elements in memory buffer. More... | |
ulonglong | max_in_memory_size |
Memory buffer size. More... | |
IO_CACHE | file |
Cache file for unique values retrieval of table read AM in executor. More... | |
TREE | tree |
Tree to filter duplicates in memory. More... | |
uchar * | record_pointers |
uint | size |
Element size. More... | |
Friends | |
int | unique_write_to_file (void *v_key, element_count count, void *unique) |
int | unique_write_to_ptrs (void *v_key, element_count count, void *unique) |
Unique – class for unique (removing of duplicates).
Puts all values to the TREE. If the tree becomes too big, it's dumped to the file. User can request sorted values, or just iterate through them. In the last case tree merging is performed in memory simultaneously with iteration, so it should be ~2-3x faster.
Unique values can be read only from final result (not on insert) because duplicate values can be contained in different dumped tree files.
Unique::Unique | ( | qsort2_cmp | comp_func, |
void * | comp_func_fixed_arg, | ||
uint | size_arg, | ||
ulonglong | max_in_memory_size_arg | ||
) |
Unique::~Unique | ( | ) |
|
inline |
|
private |
Flush tree to disk.
bool Unique::get | ( | TABLE * | table | ) |
|
inline |
|
inline |
|
static |
|
inline |
void Unique::reset | ( | void | ) |
|
inline |
Add new value to Unique.
The value is inserted either to the tree, or to the duplicate weedout table, depending on the mode of operation. If tree's mem buffer is full, it's flushed to the disk.
ptr | pointer to the binary string to insert |
bool Unique::walk | ( | tree_walk_action | action, |
void * | walk_action_arg | ||
) |
|
friend |
|
friend |
ulong Unique::elements |
|
private |
Cache file for unique values retrieval of table read AM in executor.
|
private |
Array of file pointers.
|
private |
Max elements in memory buffer.
|
private |
Memory buffer size.
|
private |
|
private |
Element size.
|
private |
Tree to filter duplicates in memory.