> When I execute the explain on a simple join query I see that the indices
are
> NOT used for
> the join:
>
> explain select tblAccountAvailablePlugins.nAcctPluginDirID,
> tblAccountPluginDir.nAcctPluginDirID FROM tblAccountAvailablePlugins,
> tblAccountPluginDir WHERE
>
tblAccountPluginDir.nAcctPluginDirID=tblAccountAvailablePlugins.nAcctPluginD
> irID;
> NOTICE: QUERY PLAN:
>
> Hash Join (cost=21.45..640.50 rows=6530 width=8)
> -> Seq Scan on tblaccountavailableplugins (cost=0.00..187.52
rows=10452
> width=4)
> -> Hash (cost=18.76..18.76 rows=1076 width=4)
> -> Seq Scan on tblaccountplugindir (cost=0.00..18.76 rows=1076
> width=4)
>
> EXPLAIN
>
> can anyone explain me what is wrong with my query?
If you haven't VACUUM ANALYZE 'd recently, do so to update the statistics on
your table(s)... The reason it's doing a sequential scan is that a seq scan
is (probably) better if that query really does return as many rows as it
thinks it does.. After you update the statistics, try again and see what the
query plan is then..
-Mitch