mysql> select count(*) from cdr;
+----------+
| count(*) |
+----------+
| 234362 |
+----------+
1 row in set (2,86 sec)
mysql> select count(*) from cdrmoj;
+----------+
| count(*) |
+----------+
| 43738 |
+----------+
1 row in set (2,60 sec)
Kao što se vidi, select count(*) se izvršava do 3 sekunde.
E onda sam napravio view
Create View | cdrbitno | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `cdrbitno` AS select
`cdrmoj`.`timestamp` AS `timestamp`,
`cdrmoj`.`channel` AS `channel`,
`cdrmoj`.`callingpres` AS `callingpres`,
`cdrmoj`.`cid_name` AS `cid_name`,
`cdrmoj`.`cid_num` AS `cid_num`,
`cdrmoj`.`cid_dnid` AS `cid_dnid`,
`cdr`.`duration` AS `duration`,
`cdr`.`billsec` AS `billsec`,
`cdrmoj`.`out_radnja` AS `out_radnja`,
`cdrmoj`.`out_broj` AS `out_broj`,
`cdrmoj`.`out_komanda` AS `out_komanda`,
`cdr`.`lastapp` AS `lastapp`,
`cdr`.`lastdata` AS `lastdata`,
`cdrmoj`.`hangupcause` AS `hangupcause`,
`cdrmoj`.`snimak` AS `snimak`,
`cdrmoj`.`pocetak` AS `pocetak`,
`cdrmoj`.`kraj` AS `kraj`,
`cdrmoj`.`id` AS `id`
from (`cdrmoj` left join `cdr` on((`cdrmoj`.`id` = `cdr`.`userfield`)))
I "slučajno" napravio upit select count(*) na toj "tabeli", i taj upit traje već oko 12 sati... i ne znam kad će da završi.
Ima li neko nešto da prokomentariše
