Re: DELETE query and indexes again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, uses the index:

explain analyze delete from statcast.play_statistics as ps
using stats as s
where ps.gid = s.gid
and ps.guid = s.guid;

It does this:

->  Index Scan using play_statistics_pkey on play_statistics ps  (cost=0.69..8.59 rows=1 width=26) (actual time=0.008..0.065 rows=108 loops=21063)
         Index Cond: ((gid = s.gid) AND (guid = s.guid))

Does not use the index:

explain analyze delete from statcast.play_statistics where gid in (select distinct gid from stats);

It does this:
-> Seq Scan on play_statistics (cost=0.00..7781818.16 rows=96600516 width=10) (actual time=201.521..396052.101 rows=96556116 loops=1)





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux