469,925 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Real-time compression for mysql udf_lzo

I found this old thread while looking for some type of compression
solution myself. Long story short, I contacted Lester and ended up
writing an LZO solution just as Mark had mentioned below. Thought this
could also benifit someone out there so I'm reposting. Here's a link
to the source code:


BTW, Lester got his zlib implementation working as well. Hopefully
these will both be posted on MySQL website UDF section soon.

-John R.

--------------- original message ---------------
From: Mark Hazen (ma*************@hotmail.com)
Subject: Re: Mysql compress_gz()/uncompress_gz() user defined
Newsgroups: mailing.database.mysql
Date: 2001-12-18 15:55:02 PST
I think this guy has made a noteworthy contribution. I've been
looking for
something like this for a while. Sure, there are ways to do it outside
MySQL but I always prefer working within MySQL. His function is great
storing big BLOB data that never needs to be searched on. I might add
suggestion though. Zlib compression is slow compared to LZO (search
compression on Google). Sure, Zlib isn't a dog and compresses better
LZO, but lzo is lightning fast for situations where the time to
compress is
very important. A function to compress_lzo and uncompress_lzo would

"Lester Hightower" <hi******@TheAIMSGroup.com> wrote in message
After sending my earlier email regarding compress_gz()/uncompress_gz() in
mysqld, I discovered user defined functions -- something I had never used
in mysqld until today.

So, I took a couple of hours and wrote a Mysql UDF to do what I requested:

# gcc -shared -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\""
" -DHAVE_CONFIG_H -I./../include -I./../regex -I. -I../include -I..
-I. -I/u
sr/local/mysql/include -O3 -DDBUG_OFF -export-dynamic -fPIC
mplates -o mysqld_udf_zlib.so mysqld_udf_zlib.cc /usr/lib/libz.a
# cp ./mysqld_udf_zlib.so /usr/lib; ldconfig

# mysql mysql
mysql> CREATE FUNCTION compress_gz RETURNS STRING SONAME "mysqld_udf_zlib.so"; CREATE FUNCTION uncompress_gz RETURNS STRING
"mysqld_udf_zlib.so"; Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)

mysql> select compress_gz('lester');
| compress_gz('lester') | +-----------------------+
| xI-.I-a |
1 row in set (0.00 sec)

mysql> select uncompress_gz(compress_gz('lester'));
| uncompress_gz(compress_gz('lester')) | +--------------------------------------+
| lester |
1 row in set (0.01 sec)

mysql> drop function compress_gz; drop function uncompress_gz;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)

It is late and I am going home for the evening. Tomorrow I will review
the code carefully, clean it up a bit, comment it well, and will then be
happy to contribute it to MySQL AB, if you guys are interested in having
it in the contributed software page. Is there a procedure for contribing
the code to you guys, or just email it to the mysql list, or what?

Lester H. Hightower TheAIMSGroup.com
Chief Technology Officer
The Advanced Integrated Management Solutions Group
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <my***************@lists.mysql.com>
To unsubscribe, e-mail <my**********************************************@ lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Jul 19 '05 #1
0 1565

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Aaron W. West | last post: by
2 posts views Thread by cwdjr | last post: by
4 posts views Thread by Allan Adler | last post: by
10 posts views Thread by Pavils Jurjans | last post: by
17 posts views Thread by David Scemama | last post: by
5 posts views Thread by Henry Wu | last post: by
reply views Thread by support | last post: by
16 posts views Thread by DirtyHarry | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.