0

I wanna create bulk. I have script:

drop index idx_1;
drop index idx_2;
drop index idx_3;

COPY games FROM '/usr/share/nginx/html/var/dumps/games#1000000.sql' DELIMITER ',';

So, I wanna drop indexes, make insertions and then rollback my indexes. (I think it is simpliest than recreating it back by "manually".)

I tried it with savepoints but failed: it doing rollback before or with inserts although I need rollback after inserts for indexes only.

How can I solve this problem? Thx

MegaBomber
  • 345
  • 2
  • 3
  • 11
  • If you rollback after the COPY, you will rollback the inserts done by the COPY statement as well. The only way to do this, is to re-create the indexes afterwards. –  Dec 23 '19 at 08:15
  • I know it. But how I can do it best? This indexes managed by Doctrine, but it don't restore some indexes after update - only after recreating table – MegaBomber Dec 23 '19 at 08:23
  • You didn't drop them through Doctrine, why would you recreate them through Doctrine? – jjanes Dec 23 '19 at 14:05
  • My hope was Doctrine will recreate my indexes. But it does recreate nothing indexes but id – MegaBomber Dec 23 '19 at 15:14

0 Answers0