Re: [PERFORM] Index on a function and SELECT DISTINCT

2005-01-17 Thread Frank Wiles
On Fri, 14 Jan 2005 12:32:12 -0600 Adrian Holovaty [EMAIL PROTECTED] wrote: If I have this table, function and index in Postgres 7.3.6 ... CREATE TABLE news_stories ( id serial primary key NOT NULL, pub_date timestamp with time zone NOT NULL, ... ) CREATE OR REPLACE

Re: [PERFORM] Index on a function and SELECT DISTINCT

2005-01-17 Thread Adrian Holovaty
Frank Wiles wrote: Adrian Holovaty [EMAIL PROTECTED] wrote: If I have this table, function and index in Postgres 7.3.6 ... CREATE TABLE news_stories ( id serial primary key NOT NULL, pub_date timestamp with time zone NOT NULL, ... ) CREATE OR REPLACE FUNCTION

Re: [PERFORM] Index on a function and SELECT DISTINCT

2005-01-17 Thread PFC
Try : EXPLAIN SELECT get_year_trunc(pub_date) as foo FROM ... GROUP BY foo Apart from that, you could use a materialized view... db=# EXPLAIN SELECT DISTINCT get_year_trunc(pub_date) FROM Ah, that makes sense. So is there a way to optimize SELECT DISTINCT queries that have no

[PERFORM] Index on a function and SELECT DISTINCT

2005-01-14 Thread Adrian Holovaty
If I have this table, function and index in Postgres 7.3.6 ... CREATE TABLE news_stories ( id serial primary key NOT NULL, pub_date timestamp with time zone NOT NULL, ... ) CREATE OR REPLACE FUNCTION get_year_trunc(timestamp with time zone) returns timestamp with time zone AS