sql全文搜索,将innodb表合并到myisam视图中?

时间:2012-01-17 04:27:41

标签: sql

我需要全文搜索的表格都是出于约束原因使用Innodb。

我想知道是否可以使用myisam引擎和全文搜索索引创建视图(如下所示)或临时表。 我已经研究过 MERGE ,但由于下面说明的原因,它将无效。还注意到我似乎无法更改VIEW的引擎类型,这可能吗?

  

某些MyISAM功能在MERGE表中不可用。例如,你   无法在MERGE表上创建FULLTEXT索引。 (你可以创造   底层MyISAM表上的FULLTEXT索引,但您不能   使用全文搜索搜索MERGE表。)

mysql> create table `users`(
    -> `id` int(10) unsigned not null auto_increment primary key,
    -> `name` varchar(100) not null,
    -> `created_at` datetime not null
    -> )engine=Innodb;
Query OK, 0 rows affected (0.01 sec)

-

mysql> create table `posts`(
    -> `id` int(10) unsigned not null auto_increment primary key,
    -> `author_id` int(10) unsigned not null,
    -> `created_at` datetime not null,
    -> `synopsis` text not null,
    -> index(author_id),
    -> foreign key (author_id)
    -> references users(id)
    -> on delete cascade
    -> )engine=Innodb;
Query OK, 0 rows affected (0.03 sec)

-

mysql> create table `ebooks`(
    -> `id` int(10) unsigned not null auto_increment primary key,
    -> `author_id` int(10) unsigned not null,
    -> `created_at` datetime not null,
    -> `synopsis` text not null,
    -> index(author_id),
    -> foreign key (author_id)
    -> references users(id)
    -> on delete cascade
    -> )engine=Innodb;
Query OK, 0 rows affected (0.01 sec)

-

mysql> create view post_search as select synopsis from posts;
Query OK, 0 rows affected (0.01 sec)

mysql> describe post_search;
+----------+------+------+-----+---------+-------+
| Field    | Type | Null | Key | Default | Extra |
+----------+------+------+-----+---------+-------+
| synopsis | text | NO   |     | NULL    |       |
+----------+------+------+-----+---------+-------+
1 row in set (0.01 sec)

-

mysql> create view ebook_search as select synopsis from ebooks;
Query OK, 0 rows affected (0.00 sec)

mysql> describe ebook_search;
+----------+------+------+-----+---------+-------+
| Field    | Type | Null | Key | Default | Extra |
+----------+------+------+-----+---------+-------+
| synopsis | text | NO   |     | NULL    |       |
+----------+------+------+-----+---------+-------+
1 row in set (0.01 sec)

0 个答案:

没有答案