473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MySQL Indexes or tables in RAM?

With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?

Regards,
Dave.
Jul 19 '05 #1
6 15991
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.

Regards,
Dave.
Jul 19 '05 #2
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.

Regards,
Dave.
Jul 19 '05 #3
On Fri, 28 Nov 2003 23:14:14 +0000 (UTC), "David Brown"
<dc**@dcb7.dyndns.org> wrote:
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.


Indexes are automatically cached in memory.

To control the size of the index cache, you set the "key_buffer_size"
in the my.cnf file. In mine, where the system has 1 gig of ram, I've
got:

set-variable = key_buffer_size=128M

The index cache is shared among all mysql threads.

To see how efficiently the indexes are being cached, do

show status like 'key%'

Key_reads is the number of times mysql has had to read index data from
disk. Key_read_requests is the number of times it needed index data.

Divide key_reads by key_read_requests to get the cache miss rate.

An example: On my server, I've got 157603570 key read requests, and
86731 key reads. That's a miss rate of 0.055%, So, 99.945% of the
time, MySQL is getting the index data from memory.

Tables can also be cached, but generally their large size makes this
not very useful. Also, each "thread" of mysql has it's own table
cache, so you need to keep the table cache small, or the system will
run out of memory, and start swapping memory to disk, completely
killing system performance.

You can create an in-memory (heap) table, but generally it's not
useful except for small data sets. And you need to handle storing it
to disk manually in your application.

If you've got a small table and want it to be an in-memory table, then
you could change the type to "heap". But, heap tables don't support
some features of other table types, so you need to read up on heap
tables. And before stopping mysql, you'd need to be sure to convert
the heap table back to a normal stored type, or you'd lose any
changes.
Chuck Gadd
http://www.csd.net/~cgadd/aqua
Jul 19 '05 #4
On Fri, 28 Nov 2003 23:14:14 +0000 (UTC), "David Brown"
<dc**@dcb7.dyndns.org> wrote:
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.


Indexes are automatically cached in memory.

To control the size of the index cache, you set the "key_buffer_size"
in the my.cnf file. In mine, where the system has 1 gig of ram, I've
got:

set-variable = key_buffer_size=128M

The index cache is shared among all mysql threads.

To see how efficiently the indexes are being cached, do

show status like 'key%'

Key_reads is the number of times mysql has had to read index data from
disk. Key_read_requests is the number of times it needed index data.

Divide key_reads by key_read_requests to get the cache miss rate.

An example: On my server, I've got 157603570 key read requests, and
86731 key reads. That's a miss rate of 0.055%, So, 99.945% of the
time, MySQL is getting the index data from memory.

Tables can also be cached, but generally their large size makes this
not very useful. Also, each "thread" of mysql has it's own table
cache, so you need to keep the table cache small, or the system will
run out of memory, and start swapping memory to disk, completely
killing system performance.

You can create an in-memory (heap) table, but generally it's not
useful except for small data sets. And you need to handle storing it
to disk manually in your application.

If you've got a small table and want it to be an in-memory table, then
you could change the type to "heap". But, heap tables don't support
some features of other table types, so you need to read up on heap
tables. And before stopping mysql, you'd need to be sure to convert
the heap table back to a normal stored type, or you'd lose any
changes.
Chuck Gadd
http://www.csd.net/~cgadd/aqua
Jul 19 '05 #5
On Fri, 28 Nov 2003 23:14:14 +0000 (UTC), "David Brown"
<dc**@dcb7.dyndns.org> wrote:
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.


In fact there is a table type that stores in RAM, but frankly I don't
see the point of doing that since MySQL is plenty fast with the usual
innoDB tables.

I suggest you go to the MySQL web site and start looking at the manual
on table types.
Ed
Jul 19 '05 #6
On Fri, 28 Nov 2003 23:14:14 +0000 (UTC), "David Brown"
<dc**@dcb7.dyndns.org> wrote:
"David Brown" <dc**@dcb7.dyndns.org> wrote in message
news:bp**********@hercules.btinternet.com...
With MySQL is it possible to have indexes or tables held in RAM? If so how
do I ensure that updates are copied to disk?


Given the amount of response I'll take that as a No.


In fact there is a table type that stores in RAM, but frankly I don't
see the point of doing that since MySQL is plenty fast with the usual
innoDB tables.

I suggest you go to the MySQL web site and start looking at the manual
on table types.
Ed
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RG | last post by:
Hopefully someone here can help. I would like to perform multiple queries to a MySQL database and have all the results in 1 result set. Is this possible? TIA RG
3
by: Braden Bowers | last post by:
I have a web program where I want to connect to my database and discover the tables within the database. Then select a table and discover the column names, their types, and lengths. Thanks in...
0
by: Eric B. | last post by:
Hi, I'm somewhat new to MySql. I've been using it for a while, but pretty much out of the box setup, and am starting to suffer heavily with my larger tables. I have a table with 5,000,000+...
1
by: scottg | last post by:
I've just applied an index to my mysql 4.0.21 database/tables and it really helped with speed. I was wondering if this index I added is automatically adjusted by mysql over time or do I have to go...
4
by: steve | last post by:
I like to create some temprary tables (in-memory tables) when mysql starts up. How do I do that. Thanks. -- Posted using the http://www.dbforumz.com interface, at author's request Articles...
2
chathura86
by: chathura86 | last post by:
i have two tables with some common column names, i want to create a table joining these tables vertically ex. one table contain deposits and another contain withdrawals, both tables have date and...
2
by: ArizonaJohn | last post by:
Hello, In a MySQL database called "feather," I have a lot of tables, and each table has a column called "site." I'm trying to show all tables that contain a record equal to $entry in the...
8
by: starman | last post by:
Hi, This should be straightforward, but I can't seem to figure it out! I have two tables called members and clubs, and a session variable called thename which is the user's user name from the login...
0
by: wesandmarlene | last post by:
I have tables defined with pk's and fks. What system table contains the foreign key column name? I see the table called information_schema.referential_integrity that contains useful information...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.