Re: DELETE query and indexes again - Mailing list pgsql-admin

From Wells Oliver
Subject Re: DELETE query and indexes again
Date
Msg-id CAOC+FBX+H_PWi9ZoNeqe2FA1L-QtwVwpWCzqGMizQ9K2TqCACA@mail.gmail.com
Whole thread Raw
In response to Re: DELETE query and indexes again  (Wells Oliver <wells.oliver@gmail.com>)
List pgsql-admin
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)




pgsql-admin by date:

Previous
From: Wells Oliver
Date:
Subject: Re: DELETE query and indexes again
Next
From: "Dischner, Anton"
Date:
Subject: AW: Encryption in pg_dump