summaryrefslogtreecommitdiff
path: root/myisam/rt_key.c
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-05-25 15:06:32 +0500
committerunknown <hf@deer.(none)>2004-05-25 15:06:32 +0500
commitc690204c701f35bda2d19f14b0e8423c80cff1bb (patch)
tree1bd30ca9cbdba7bdacc7453d22bf1f95af138fd0 /myisam/rt_key.c
parentde861db3e73b72a01eceed23095c4793f893d6c4 (diff)
downloadmariadb-git-c690204c701f35bda2d19f14b0e8423c80cff1bb.tar.gz
WL#1562 (Improving spatial code)
A set of changes improving our RTree indexes and fixed few bugs found during the tests myisam/rt_index.c: Algorythm for picking the branch to insert was fixed. pick_by_perimeter version of the algorythm added (mostly for testing purposes) myisam/rt_index.h: minimal size of the page set to 1/3 It noticeable increases searching performance myisam/rt_key.c: counting of the size of the filled part of the page fixed rtree_choose_key moved to rt_index.c myisam/rt_key.h: no need to make rtree_choose_key global myisam/rt_mbr.c: operations for counting the perimeter of MBR added myisam/rt_mbr.h: interface for rtree_perimeter_increase myisam/rt_split.c: my_multi_malloc changed with my_alloca sql/spatial.cc: LINESTRING object can consist of single point
Diffstat (limited to 'myisam/rt_key.c')
-rw-r--r--myisam/rt_key.c46
1 files changed, 2 insertions, 44 deletions
diff --git a/myisam/rt_key.c b/myisam/rt_key.c
index f18d13af8d8..0384849e5e7 100644
--- a/myisam/rt_key.c
+++ b/myisam/rt_key.c
@@ -35,7 +35,8 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint page_size = mi_getint(page_buf);
uint nod_flag = mi_test_if_nod(page_buf);
- if (page_size + key_length + nod_flag <= keyinfo->block_length)
+ if (page_size + key_length + info->s->base.rec_reflength <=
+ keyinfo->block_length)
{
/* split won't be necessary */
if (nod_flag)
@@ -94,46 +95,3 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length);
}
-
-
-/*
- Choose non-leaf better key for insertion
-*/
-
-uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
- uint key_length, uchar *page_buf, uint nod_flag)
-{
- double increase;
- double best_incr = DBL_MAX;
- double area;
- double best_area;
- uchar *best_key;
- uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
- uchar *last = rt_PAGE_END(page_buf);
-
- LINT_INIT(best_area);
- LINT_INIT(best_key);
-
- for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
- {
- if ((increase = rtree_area_increase(keyinfo->seg, key, k, key_length,
- &area)) == -1)
- return NULL;
- if (increase < best_incr)
- {
- best_key = k;
- best_area = area;
- best_incr = increase;
- }
- else
- {
- if ((increase == best_incr) && (area < best_area))
- {
- best_key = k;
- best_area = area;
- best_incr = increase;
- }
- }
- }
- return best_key;
-}