Arnau <arnaulist(at)andromeiberica(dot)com> writes:
> Seq Scan on agenda_users_groups (cost=0.00..53108.45 rows=339675
> width=8) (actual time=916.903..5763.830 rows=367026 loops=1)
> Filter: (group_id = 9::numeric)
> Total runtime: 7259.861 ms
> (3 filas)
> espsm_moviltelevision=# select count(*) from agenda_users_groups ;
> count
> ---------
> 2547556
So the SELECT is fetching nearly 15% of the rows in the table. The
planner is doing *the right thing* to use a seqscan, at least for
this particular group_id value.
regards, tom lane