The Hermit Hacker wrote:
"use cut-n-paste please, and send us the results of the
EXPLAIN ... stuff
like the cost estimates and whatnot tell us *so* much
..."
This is it:
exis=# \d pvdprcodNUMART | integer | not nullNUMDEP | smallint | not nullNUMPRO | smallint | not
nullMODELO | varchar(20) | not nullTALLA | varchar(4) | not nullCOLOR | varchar(3) | not null
exis=# \d venartcvetda | smallint | not nullnumdep | smallint | not nullnumart | integer | not nullmes
| smallint | not nullanio | integer | not nulltipotr | varchar(2) |importe | float8 |cantidad |
float8 |
exis=# explain select
cvetda,anio,mes,sum(importe),sum(cantidad)
exis-# from venart where numart in
exis-# (select "NUMART" from pvdprcod where "NUMDEP"=7
and "NUMPRO"=108)
exis-# group by cvetda,numdep,anio,mes;
NOTICE: QUERY PLAN:
Aggregate (cost=79015875401357.48..79015875413208.91
rows=79010 width=26) -> Group (cost=79015875401357.48..79015875409258.44
rows=790095 width=26) -> Sort
(cost=79015875401357.48..79015875401357.48 rows=790095
width=26) -> Seq Scan on venart
(cost=100000000.00..79015875283591.09 rows=790095
width=26) SubPlan -> Materialize
(cost=100007942.42..100007942.42 rows=34 width=4) -> Seq Scan on pvdprcod
(cost=100000000.00..100007942.42 rows=34 width=4)
EXPLAIN
Why Seq Scan if indexes have been created on the
columns used for access?
Best regards,
Franz J Fortuny