mysql 사용시 memory DB 사용시 궁금한 점
글쓴이: softpro / 작성시간: 월, 2005/12/26 - 2:46오후
이번에 memory DB를 사용해볼려고 하는데 몇가지 궁금한점이 있습니다.
1. 메모리 DB 사용시 메모리 DB내용을 다른 MYI등으로 백업이 가능한건지 궁금하구요.
2. create database 로 여러개의 DB 생성이 가능 할까요?
3. 여러 테이블을 JOIN등으로 검색이 가능한지 궁금합니다.
질문에 요지는 일반 MYIAM 방식을 사용할때 와 메모리 DB를 사용할때 차이점이라든지 제약 사항이 궁금 합니다.
Forums:
mysql에서 메모리(heap) 타입의 테이블에 대한 특징이나 제약사항은
mysql에서 메모리(heap) 타입의 테이블에 대한 특징이나 제약사항은 http://dev.mysql.com/doc/refman/4.1/en/memory-storage-engine.html에서 확인하실 수 있습니다.
1처럼 MYI로 저장되길 원하신다면 myisam타입의 테이블을 만드신 후에 insert into myisam select * from memory; 이런식으로 하시면 될것 같고요 (다른 매끈한 방법이 있을런지는 모르겠습니다만)
2번은, memory니 myisam이니 하는것들은 테이블에 대한 이야기이기때문에 메모리 타입의 db를 만드실수는 없습니다.
3은 가능합니다.
잠깐 찾아보니 1번의 경우 [url]http://dev.mysql.com
잠깐 찾아보니 1번의 경우 http://dev.mysql.com/doc/refman/4.1/en/create-table.html 에 나와있는 CREATE TABLE ... SELECT 를 쓰면 좀더 깔끔하게 해결되겠네요.
아니면 단순히 ALTER TABLE memory_type_table TYPE = MYISAM; 하셔서 myisam 타입으로 변경을 해버리셔도 되고요.
2번째 질문에서 만약에 mysql>create database
2번째 질문에서 만약에
mysql>create database foo;
mysql> use foo;
그런후에 memory type에 table을 두개 만들고 그리고 다시
mysql>create database baa;
mysql>use baa;
위와 같이 해서 memory type에 table을 두개 만들어서 프로그램에서 두개의 DB에 접속해서 insert, select 와 같은 기능을 할수 없나요?
할 수 있습니다.
할 수 있습니다.
답변 감사 합니다. 정말 도움이 많이 된거 같습니다. ^^다시 한가지
답변 감사 합니다. 정말 도움이 많이 된거 같습니다. ^^
다시 한가지 궁금한 점이 있는데요. memory type으로 해서 사용하다가 메모리가 오버 나면 어떻게 되는지 궁금 합니다.
저도 그렇게까지 해본적은 없지만.. 메뉴얼을 찾아보시면 관련된 항목이 있
저도 그렇게까지 해본적은 없지만.. 메뉴얼을 찾아보시면 관련된 항목이 있습니다.
# MEMORY table contents are stored in memory, which is a property that MEMORY tables share with internal tables that the server creates on the fly while processing queries. However, the two types of tables differ in that MEMORY tables are not subject to storage conversion, whereas internal tables are:
*If an internal table becomes too large, the server automatically converts it to an on-disk table. The size limit is determined by the value of the tmp_table_size system variable.
*MEMORY tables are never converted to disk tables. To ensure that you don't accidentally do anything foolish, you can set the max_heap_table_size system variable to impose a maximum size on MEMORY tables. For individual tables, you can also specify a MAX_ROWS table option in the CREATE TABLE statement.
대략.. 메모리가 부족하면 임시로 디스크를 사용한다고 하는데, 이렇게까지 할바엔 메모리타입 테이블을 쓰는 의미가 없지 않을까싶네요.
댓글 달기