Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7cf1d259
Commit
7cf1d259
authored
Jun 02, 2004
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl 1562 (To improve RTree indexes)
some changes to make code nicer
parent
f200b0fb
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
256 additions
and
270 deletions
+256
-270
include/myisampack.h
include/myisampack.h
+7
-0
myisam/rt_index.c
myisam/rt_index.c
+2
-10
myisam/rt_mbr.c
myisam/rt_mbr.c
+182
-253
myisam/rt_test.c
myisam/rt_test.c
+60
-2
mysql-test/r/gis-rtree.result
mysql-test/r/gis-rtree.result
+5
-5
No files found.
include/myisampack.h
View file @
7cf1d259
...
...
@@ -21,6 +21,10 @@
better compression
*/
/* these two are for uniformity */
#define mi_sint1korr(A) (int8)(*A)
#define mi_uint1korr(A) (uint8)(*A)
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
((int16) ((int16) (A)[0]) << 8))
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
...
...
@@ -75,6 +79,9 @@
(((uint32) ((uchar) (A)[0])) << 24))) <<\
32))
/* This one is for uniformity */
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
*((uchar*) ((T)+1))= (uchar)(def_temp); \
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }
...
...
myisam/rt_index.c
View file @
7cf1d259
...
...
@@ -462,21 +462,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
if
((
increase
=
rtree_perimeter_increase
(
keyinfo
->
seg
,
k
,
key
,
key_length
,
&
perimeter
))
==
-
1
)
return
NULL
;
if
(
increase
<
best_incr
)
if
((
increase
<
best_incr
)
||
(
increase
==
best_incr
&&
perimeter
<
best_perimeter
))
{
best_key
=
k
;
best_perimeter
=
perimeter
;
best_incr
=
increase
;
}
else
{
if
((
increase
==
best_incr
)
&&
(
perimeter
<
best_perimeter
))
{
best_key
=
k
;
best_perimeter
=
perimeter
;
best_incr
=
increase
;
}
}
}
return
best_key
;
}
...
...
myisam/rt_mbr.c
View file @
7cf1d259
This diff is collapsed.
Click to expand it.
myisam/rt_test.c
View file @
7cf1d259
...
...
@@ -31,6 +31,51 @@ static void create_record1(char *record,uint rownr);
static
void
print_record
(
char
*
record
,
my_off_t
offs
,
const
char
*
tail
);
static
int
run_test
(
const
char
*
filename
);
static
double
rt_data
[]
=
{
/*1*/
0
,
10
,
0
,
10
,
/*2*/
5
,
15
,
0
,
10
,
/*3*/
0
,
10
,
5
,
15
,
/*4*/
10
,
20
,
10
,
20
,
/*5*/
0
,
10
,
0
,
10
,
/*6*/
5
,
15
,
0
,
10
,
/*7*/
0
,
10
,
5
,
15
,
/*8*/
10
,
20
,
10
,
20
,
/*9*/
0
,
10
,
0
,
10
,
/*10*/
5
,
15
,
0
,
10
,
/*11*/
0
,
10
,
5
,
15
,
/*12*/
10
,
20
,
10
,
20
,
/*13*/
0
,
10
,
0
,
10
,
/*14*/
5
,
15
,
0
,
10
,
/*15*/
0
,
10
,
5
,
15
,
/*16*/
10
,
20
,
10
,
20
,
/*17*/
5
,
15
,
0
,
10
,
/*18*/
0
,
10
,
5
,
15
,
/*19*/
10
,
20
,
10
,
20
,
/*20*/
0
,
10
,
0
,
10
,
/*1*/
100
,
110
,
0
,
10
,
/*2*/
105
,
115
,
0
,
10
,
/*3*/
100
,
110
,
5
,
15
,
/*4*/
110
,
120
,
10
,
20
,
/*5*/
100
,
110
,
0
,
10
,
/*6*/
105
,
115
,
0
,
10
,
/*7*/
100
,
110
,
5
,
15
,
/*8*/
110
,
120
,
10
,
20
,
/*9*/
100
,
110
,
0
,
10
,
/*10*/
105
,
115
,
0
,
10
,
/*11*/
100
,
110
,
5
,
15
,
/*12*/
110
,
120
,
10
,
20
,
/*13*/
100
,
110
,
0
,
10
,
/*14*/
105
,
115
,
0
,
10
,
/*15*/
100
,
110
,
5
,
15
,
/*16*/
110
,
120
,
10
,
20
,
/*17*/
105
,
115
,
0
,
10
,
/*18*/
100
,
110
,
5
,
15
,
/*19*/
110
,
120
,
10
,
20
,
/*20*/
100
,
110
,
0
,
10
,
-
1
};
int
main
(
int
argc
__attribute__
((
unused
)),
char
*
argv
[]
__attribute__
((
unused
)))
{
...
...
@@ -55,7 +100,7 @@ int run_test(const char *filename)
int
key_type
=
HA_KEYTYPE_DOUBLE
;
int
key_length
=
8
;
int
null_fields
=
0
;
int
nrecords
=
300
;
int
nrecords
=
sizeof
(
rt_data
)
/
(
sizeof
(
double
)
*
4
);
/* 3000;*/
int
rec_length
=
0
;
int
uniques
=
0
;
int
i
;
...
...
@@ -399,7 +444,7 @@ static void create_record1(char *record,uint rownr)
}
static
void
create_record
(
char
*
record
,
uint
rownr
)
static
void
create_record
0
(
char
*
record
,
uint
rownr
)
{
int
i
;
char
*
pos
;
...
...
@@ -419,3 +464,16 @@ static void create_record(char *record,uint rownr)
pos
+=
sizeof
(
c
);
}
}
static
void
create_record
(
char
*
record
,
uint
rownr
)
{
int
i
;
char
*
pos
;
double
*
data
=
rt_data
+
rownr
*
4
;
record
[
0
]
=
0x01
;
/* DEL marker */
for
(
pos
=
record
+
1
,
i
=
0
;
i
<
ndims
*
2
;
i
++
)
{
float8store
(
pos
,
data
[
i
]);
pos
+=
8
;
}
}
mysql-test/r/gis-rtree.result
View file @
7cf1d259
...
...
@@ -167,12 +167,10 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 32 NULL
4
Using where
1 SIMPLE t1 range g g 32 NULL
7
Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
...
...
@@ -181,6 +179,8 @@ fid AsText(g)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
...
...
@@ -305,10 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
46 LINESTRING(51 41,60 50)
56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
46 LINESTRING(51 41,60 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment