On Sun, 3 Oct 1999, Jani Tolonen wrote:
> Robbin Zhang writes:
> > On Sun, 3 Oct 1999 sinisa@stripped wrote:
> >
> > > HI!
> > >
> > > It would be easier for you if you would you one instance of MySQL
> > > server, do not use any RAM disk, then on start-up create HEAP tables
> > > (available with 3.23.xx) and copy disk tables to HEAP tables. Then,
> > > all you have to do is run insert/update/delete to both copies of
> > > tables, while SELECT's would be run from the HEAP tables.
> > >
> >
> > Any detail on how to do this ? Can you give a few examples or a pointer
> > to the doc ? Thanks !
> >
> > Robbin
>
> Hi Robbin,
>
> CREATE TABLE test TYPE=HEAP SELECT ip,SUM(downloads) as down FROM
> log_table GROUP BY ip;
>
> SELECT COUNT(ip),AVG(down) from test;
> DROP TABLE test;
>
> Here are some things you should consider when you use HEAP tables: You
> should always use specify MAX_ROWS in the CREATE statement to ensure
> that you accidently do not use all memory. Indexes will only be used
> with = and <=> (but are VERY fast). HEAP tables uses a fixed record
> length format. HEAP doesn't support BLOB/TEXT columns. HEAP doesn't
> support AUTO_INCREMENT columns. HEAP doesn't support an index on a
> NULL column. You can have non-unique keys in a HEAP table (not that
> normal with hashed tables). HEAP tables are shared between all
> clients (just like any other table). Data for HEAP tables are
> allocated in small blocks. The tables are 100% dynamic (on
> inserting). No overflow areas and no extra key space is needed.
> Deleted rows are put in a linked list and will be reused when you
> insert new data into the table. To free memory, you should execute
> DELETE FROM heap_table or DROP TABLE heap_table. To ensure that you
> accidentally don't do anything stupid, you can't create HEAP tables
> bigger than max_heap_table_size.
>
> HEAP is the keyword.
Thanks. It is really helpful. I am also reading the manual now.
Thanks again.
Robbin
>
> Regards,
>
> - Jani
>
> --
> +-------------------------------------------------------------+
> | TcX ____ __ _____ _____ ___ |
> | /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Jani Tolonen |
> | /*/ /*/ /*/ \*\_ |*| |*||*| jani@stripped |
> | /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Helsinki |
> | /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|_____ Finland |
> | ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
> | /*/ \*\ Developers Team |
> +-------------------------------------------------------------+
>
> > > Do take into account the limitations of HEAP tables.
> > >
> > > Sinisa
> > >
> > > +----------------------------------------------------------------------+
> > > | TcX ____ __ _____ _____ ___ == mysql@stripped |
> > > | /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic |
> > > | /*/ /*/ /*/ \*\_ |*| |*||*| mailto:sinisa@stripped|
> > > | /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Larnaka, Cyprus |
> > > | /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ |
> > > | ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
> > > | /*/ \*\ Developers Team |
> > > +----------------------------------------------------------------------+
> > >
> > > ---------------------------------------------------------------------
> > > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> > > posting. To request this thread, e-mail mysql-thread14955@stripped
> > >
> > > To unsubscribe, send a message to the address shown in the
> > > List-Unsubscribe header of this message. If you cannot see it,
> > > e-mail mysql-unsubscribe@stripped instead.
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> > posting. To request this thread, e-mail mysql-thread14964@stripped
> >
> > To unsubscribe, send a message to the address shown in the
> > List-Unsubscribe header of this message. If you cannot see it,
> > e-mail mysql-unsubscribe@stripped instead.
>
>