Rhaoni Chiu Pereira <rhaoni@sistemica.info> writes:
> When I run a explain analyze with this where clause:
> ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ...
> ...
> -> Seq Scan on gsames00 (cost=100000000.00..100000006.72 rows=372 width=10)
> (actual time=0.01..0.96 rows=372 loops=19923)
> ...
If you're not going to show us the whole query and the whole EXPLAIN
output, you're going to get equally incomplete answers. I will say
though that forcing an index instead of a seqscan on a 372-row table
isn't likely to be a magic bullet. You probably need a better join
plan.
Please post fuller details on pgsql-performance. You might save some
time by reading the posting tips first ...
http://techdocs.postgresql.org/guides/SlowQueryPostingGuidelines
regards, tom lane