X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A29ED1B198 for ; Tue, 13 Jul 2004 02:51:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33112-03 for ; Tue, 13 Jul 2004 05:51:37 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by svr1.postgresql.org (Postfix) with SMTP id D389BD1B181 for ; Tue, 13 Jul 2004 02:51:29 -0300 (ADT) Received: by mproxy.gmail.com with SMTP id 73so337085rne for ; Mon, 12 Jul 2004 22:51:27 -0700 (PDT) Received: by 10.38.90.5 with SMTP id n5mr500241rnb; Mon, 12 Jul 2004 22:51:27 -0700 (PDT) Message-ID: Date: Mon, 12 Jul 2004 22:51:27 -0700 From: Chris Cheston To: pgsql-performance@postgresql.org Subject: How to create an index for type timestamp column using rtree? Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/69 X-Sequence-Number: 7460 Hi all, I'm storing some timestamps as integers (UTF) in a table and I want to query by <= and >= for times between a certain period. The table has gotten quite large and is now very slow in querying. I think it's time to create an index for the timestamp column. I tried using an rtree (for <= and >= optimization): create INDEX logs_timestamp ON logs using rtree (timestamp); but I get ERROR: data type integer has no default operator class for access method "rtree" You must specify an operator class for the index or define a default operator class for the data type Do I have to create an rtree type for my timestamp integer column? Existing rtree columns are below. Pls help. Thanks, Chris server=> select am.amname as acc_method, opc.opcname as ops_name from pg_am am, pg_opclass opc where opc.opcamid = am.oid order by acc_method, ops_name; acc_method | ops_name ------------+----------------- btree | abstime_ops btree | bit_ops btree | bool_ops btree | bpchar_ops btree | bytea_ops btree | char_ops btree | cidr_ops btree | date_ops btree | float4_ops btree | float8_ops btree | inet_ops btree | int2_ops btree | int4_ops btree | int8_ops btree | interval_ops btree | macaddr_ops btree | name_ops btree | numeric_ops btree | oid_ops btree | oidvector_ops btree | text_ops btree | time_ops btree | timestamp_ops btree | timestamptz_ops btree | timetz_ops btree | varbit_ops btree | varchar_ops hash | bpchar_ops hash | char_ops hash | cidr_ops hash | date_ops hash | float4_ops hash | float8_ops hash | inet_ops hash | int2_ops hash | int4_ops hash | int8_ops hash | interval_ops hash | macaddr_ops hash | name_ops hash | oid_ops hash | oidvector_ops hash | text_ops hash | time_ops hash | timestamp_ops hash | timestamptz_ops hash | timetz_ops hash | varchar_ops rtree | bigbox_ops rtree | box_ops rtree | poly_ops (51 rows)