By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,978 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,978 IT Pros & Developers. It's quick & easy.

Real-time compression for mysql udf_lzo

P: n/a
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*************
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******> 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 /usr/lib/libz.a
# cp ./ /usr/lib; ldconfig

# mysql mysql
""; 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
Chief Technology Officer
The Advanced Integrated Management Solutions Group
Before posting, please check: (the manual) (the list archive)

To request this thread, e-mail <my***************>
To unsubscribe, e-mail <my**********************************************@>
Trouble unsubscribing? Try:

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.