query takes a long time

From: Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: query takes a long time
Date: 2008-08-23 19:51:51
Message-ID: 200808232051.51544.garry@schoolteachers.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can someone suggest how I could speed up the execution of this query?

select count(distinct attendance.studentid)
from attendance
where attendance.studentid not in (select studentid from attendance where auth not in('C','E','F','G','H','I','M','N','O','R','S','T','U'))

It returns the correct results but very slowly.
regards
garry

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-08-23 20:00:23 Re: [GENERAL] Surprising syntax error
Previous Message Bruce Momjian 2008-08-23 19:49:44 Re: [GENERAL] Surprising syntax error