From the postgresql todo list:
- Allow CREATE INDEX zman_index ON test (date_trunc( 'day', zman ) datetime_ops)
fails index can't store constant parameters
So that's your first problem.
What you can probably do is create your own function sort of like this:
CREATE FUNCTION myfunc(date) RETURNS integer AS'
date (date_trunc ('day', trafbytes_date)
' LANGUAGE 'SQL' WITH iscachable, isstrict;
CREATE INDEX myindex on tbl_trafbytes(myfunc(trafbytes_date));
NOTE: THIS IS PSEUDO CODE - IT WON'T WORK EXACTLY AS-IS.
Chris