improved index for attachment table

Change-Id: Ib333bbcba35a27eccdba10b18dd1a32a775f82d0
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ 2016-06-19 20:24:23 +02:00
parent d04776fb5f
commit 3b60f279ea

View File

@ -90,8 +90,7 @@ create table if not exists `attachment` (
) Engine=InnoDB;
create index `attachment_idx` on `attachment`(`piler_id`);
create index `attachment_idx2` on `attachment`(`sig`);
create index `attachment_idx3` on `attachment`(`ptr`);
create index `attachment_idx2` on `attachment`(`sig`, `size`, `ptr`);
drop view if exists `v_attachment`;
create view `v_attachment` AS select `id` as `i`, `piler_id`, `attachment_id`, `ptr`, (select count(*) from `attachment` where `ptr`=`i`) as `refcount` from `attachment`;