Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine. - Mailing list pgsql-performance

From Greg Stark
Subject Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
Date
Msg-id 87ad7icsxw.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Responses Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.
List pgsql-performance
Rajesh Kumar Mallah <mallah@trade-india.com> writes:

> Nopes the query are not Equiv , earlier one returns 4 rows and the below one
> none,

Sorry, i lowercased a string constant and dropped the lower() on email.

Try this:

SELECT *
  FROM tickets
 WHERE id IN (
       SELECT groups.instance
         FROM groups
         JOIN principals ON (groups.id = principals.objectid)
         JOIN cachedgroupmembers ON (principals.id = cachedgroupmembers.groupid)
         JOIN users ON (cachedgroupmembers.memberid = users.id)
        WHERE lower(users.emailaddress) = 'mallah_rajesh@yahoo.com'
          AND groups.domain = 'RT::Ticket-Role'
          AND groups.type   = 'Requestor'
          AND principals.principaltype = 'group'
  )
  AND type = 'ticket'
  AND effectiveid = tickets.id
  AND (status = 'new' OR status = 'open')
ORDER BY priority DESC
LIMIT 10;

--
greg

pgsql-performance by date:

Previous
From: Jesse
Date:
Subject: Re: PostgreSQL 7.4beta5 vs MySQL 4.0.16 with RT(DBIx::SearchBuilder)
Next
From: Rajesh Kumar Mallah
Date:
Subject: Re: Query puts 7.3.4 on endless loop but 7.4beta5 is fine.