pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chris smith <dmagick@gmail.com>
To: arnaulist@andromeiberica.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Query on postgresql 7.4.2 not using index
Date: Tue, 25 Apr 2006 23:34:24 +1000
Message-ID: <3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com> (raw)
In-Reply-To: <444E240D.3050000@andromeiberica.com>
References: <444E240D.3050000@andromeiberica.com>

On 4/25/06, Arnau <arnaulist@andromeiberica.com> wrote:
> Hi all,
>
>    I have the following running on postgresql version 7.4.2:
>
> CREATE SEQUENCE agenda_user_group_id_seq
> MINVALUE 1
> MAXVALUE 9223372036854775807
> CYCLE
> INCREMENT 1
> START 1;
>
> CREATE TABLE AGENDA_USERS_GROUPS
> (
>   AGENDA_USER_GROUP_ID  INT8
>                         CONSTRAINT pk_agndusrgrp_usergroup PRIMARY KEY
>                         DEFAULT NEXTVAL('agenda_user_group_id_seq'),
>   USER_ID               NUMERIC(10)
>                         CONSTRAINT fk_agenda_uid  REFERENCES
> AGENDA_USERS (USER_ID)
>                         ON DELETE CASCADE
>                         NOT NULL,
>   GROUP_ID              NUMERIC(10)
>                         CONSTRAINT fk_agenda_gid  REFERENCES
> AGENDA_GROUPS (GROUP_ID)
>                         ON DELETE CASCADE
>                         NOT NULL,
>   CREATION_DATE         DATE
>                         DEFAULT CURRENT_DATE,
>                         CONSTRAINT un_agndusrgrp_usergroup
> UNIQUE(USER_ID, GROUP_ID)
> );
>
> CREATE INDEX i_agnusrsgrs_userid ON AGENDA_USERS_GROUPS ( USER_ID );
> CREATE INDEX i_agnusrsgrs_groupid ON AGENDA_USERS_GROUPS ( GROUP_ID );
>
>
> When I execute:
>
> EXPLAIN ANALYZE SELECT agenda_user_group_id FROM agenda_users_groups
> WHERE group_id = 9;

Try

EXPLAIN ANALYZE SELECT agenda_user_group_id FROM agenda_users_groups
WHERE group_id::int8 = 9;

or

EXPLAIN ANALYZE SELECT agenda_user_group_id FROM agenda_users_groups
WHERE group_id = '9';

and let us know what happens.

--
Postgresql & php tutorials
http://www.designmagick.com/



view thread (11+ messages)  latest in thread

Message-ID: <3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com>
Permalink:  ../3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com/
Also on:    postgresql.org/message-id/3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: dmagick@gmail.com, arnaulist@andromeiberica.com
  Subject: Re: Query on postgresql 7.4.2 not using index
  In-Reply-To: <3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com>
  References: <444E240D.3050000@andromeiberica.com> <3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox