2010/1/8 Adrian Klaver <adrian.klaver@xxxxxxxxx>: > This looks a lot like this thread: > http://archives.postgresql.org/pgsql-general/2009-12/msg00726.php > > Could we see the schema and indexes for this table? Table "public.attachment" Column | Type | Modifiers | Description --------------------+-----------------------------+-----------+------------- attachment_id | integer | not null | entity_kind | character varying(15) | | entity_id | integer | | attached_by | integer | not null | when_attached | timestamp without time zone | not null | when_uploaded | timestamp without time zone | | file_name | character varying(255) | not null | file_size | integer | not null | hash | character varying(50) | | description | character varying(300) | | thumb | bytea | | target_entity_kind | character varying(15) | | target_entity_id | integer | | file_size_enc | bigint | | hash_enc | character varying(50) | | secure_key | bytea | | status | character varying(50) | | width | integer | | height | integer | | lat | numeric(10,7) | | lon | numeric(10,7) | | created_date | timestamp without time zone | | created_time | integer | | Indexes: "attachment_pkey" PRIMARY KEY, btree (attachment_id) "attachment_by_entity" btree (entity_kind, entity_id) "attachment_by_entity_id" btree (entity_id) "attachment_by_target_entity" btree (target_entity_kind, target_entity_id) "attachment_by_uploaded" btree (when_uploaded) "attachment_by_user" btree (attached_by) "attachment_hash_ix" btree (hash) Foreign-key constraints: "fk8af75923d38260d2" FOREIGN KEY (attached_by) REFERENCES usr(usr_id) Rules: attachment_no_delete AS ON DELETE TO attachment DO INSTEAD SELECT no_delete() AS no_delete Has OIDs: no -- Konrad Garus -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general