Uros writes:
> explain SELECT count(*) as views FROM stat_views WHERE date_part('day', created) = 18;
>
> QUERY PLAN
> ------------------------------------------------------------------------------------
> Aggregate (cost=100101618.08..100101618.08 rows=1 width=0)
> -> Seq Scan on stat_views (cost=100000000.00..100101565.62 rows=20984 width=0)
> Filter: (date_part('day'::text, created) = 18::double precision)
Create an index on date_part('day', created). In 7.3 and earlier you need
to create a wrapper function and index that, in 7.4 you can index
arbitrarz expressions directly. The documentation contains more
information about that.
--
Peter Eisentraut peter_e@gmx.net