MySQL file system is faster (1)

Source: Internet
Author: User

This is a Linux file system under development. MySQL Databases on Linux can be processed as file systems. The development team hopes to get more suggestions. The following article translated from:

Http://no.spam.ee /~ Tonu/mysqlfs.html


--------------------------------

In fact, this is not a file system in the general sense. It does not have disk space, but uses the MySQL daemon to store data. SQL tables and some functions can be implemented through the file system.


1. How to implement it?


Let's look at the instance:


[Root @ localhost/root] # mount-t corbafs-o 'cat/tmp/mysqlcorbafs. ior 'none/mnt/mysql/


[Root @ localhost/root] # mount

/Dev/hda3 on/type ext2 (rw)

None on/proc type proc (rw)

None on/dev/pts type devpts (rw, gid = 5, mode = 620)

/Dev/hda1 on/mnt/win type vfat (rw, mode = 777)

/Dev/hda4 on/mnt/linux type vfat (rw, noexec, nosuid, nodev, mode = 777)

None on/mnt/mysql type corbafs (rw, IOR: 01e50d401b00000049444c3a436f000026146532f46696c6553797374656d3a
312e300000000000000000000000030000000010100000a0000003132372e302e302e
3100080418000000000000009224bc335663462a0000000ef7ae13c0943c59f)


[Root @ localhost/root] # ls-la/mnt/mysql/


Total 0


-R-xr-x 1 root 4096 dets 29. uptime

Dr-xr-x 1 root 4096 dets 29 test

Dr-xr-x 1 root 4096 dets 29 22: 21 mysql


[Root @ localhost/root] # cat/mnt/mysql/. uptime


1994


[Root @ localhost/root] # cat/mnt/mysql/user/Host


Cpq. spam. ee

Cpq. spam. ee

Localhost

Localhost

Localhost

Localhost

Localhost

Localhost


[Root @ localhost/root] # cat/mnt/mysql/user/Insert_priv

N

N

N

N

N

N

Y

Y


[Root @ localhost/root] # umount/mnt/mysql/
2. Why?


In some cases, this can make your work easier. Both MySQL and file systems are called databases, but they have different concepts and advantages and disadvantages. In a file system, objects can be quickly and easily found, even if the name is changed. Every beginner should probably learn operations like move/copy/rename/delete. But SQL is different. It uses applications to manipulate data stored in the file system. The MySQL file system implements SQL at the user level. Users can operate databases in the way they know.


-If any new product needs to access data through the network, it must support some protocols and other possible methods to access the file system through the network. MySQL tables can be accessed in this way, even if MySQL is not migrated to the corresponding platform.


-Backup and Version Control: common file systems can be implemented through any backup software. You can use diff to compare the data and use cvs to control the version.


-For a shorter programming time, sometimes people need to save simple data, such as the current date or site name, which rarely changes. The common method needs to be:

Connect to the server-> select database-> Execute Command-> store results


After using the MySQL file system, you only need one sentence: (PHP implementation)


Include (?/mountpoint/database/table/field );


Alternatively, use the following expression:


Include (?/mnt/mysql/sitedata/topic/todaytopic );

This makes it easy to understand and consumes less space. You can also share/mnt/mysql through SAMBA to directly modify the SQL database. Writing text directly to the database, or using the copy/paste function to put images into the database is much more effort-saving than writing hundreds of lines of programs using Perl or PHP.
3. What is the performance?


At the time of this article, the file system is still in the prototype development stage, so the speed is not ideal. When it comes to official release, some database functions will be faster than using SQL. Of course, many of them cannot be compared with SQL. In terms of performance and functionality, many complex queries still need to be completed through SQL statements. However, this saves a lot of development and training time, So efficiency is also a save.

4. Supported table types:

Currently, this file system supports all table types: MyISAM, DBD, HEAP, and ISAM.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.