"Fabio Panizzutti" <panizzutti@interlogica.net> writes:
> I don't understand why the planner chose a different query plan on
> identical tables with same indexes .
Different data statistics; not to mention different table sizes
(the cost equations are not linear).
Have you ANALYZEd (or VACUUM ANALYZEd) both tables recently?
If the stats are up to date but still not doing the right thing,
you might try increasing the statistics target for the larger
table's tag_id column. See ALTER TABLE SET STATISTICS.
regards, tom lane