Stan Bielski <[EMAIL PROTECTED]> writes: > Table "public.allflow_tv_mydoom" > Column | Type | Modifiers > ------------+---------+----------- > tv_s | bigint | ^^^^^^ > Indexes: allflow_tv_mydoom_x btree (tv_s)
> standb=# explain select * from allflow_tv_mydoom where tv_s < 1074200099 > and tv_s > 107506499; > [ gives seqscan ] This is a FAQ :-(. Unadorned integer constants are taken to be int4 not int8 (unless they are too large for int4), and cross-data-type comparisons are not indexable in existing releases. So you have to explicitly cast the comparison values to int8: explain select * from allflow_tv_mydoom where tv_s < 1074200099::bigint and tv_s > 107506499::bigint; (or use the standard CAST syntax if you prefer). 7.5 will have a fix for this ancient annoyance. BTW, is there a reason to be using tv_s+tv_us and not just a single timestamptz column? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend