From: | Alexander Lohse <al(at)humantouch(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Speeding up Query |
Date: | 2001-05-14 16:00:36 |
Message-ID: | p05100300b725af0d9fff@[192.168.0.89] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>This is pretty horrid: you are generating a cross product of
>events * event_ref * teams * orgs * pers and then selecting rows
>multiple times out of that very large set. No wonder you lost
>patience even with a small test database. I think you wanted
>something like
>
>...
>INTERSECT (
>
>select events.id from events where
>(lower(events.head) like '%web%'
> or lower(events.search) like '%web%'
> or lower(events.ort) like '%web%'
> or lower(events.text) like '%web%'
>
>union
>
>select teams.id from teams where
>lower(teams.name) like '%web%'
>
>union
>
Hi Tom,
this thing is a bit more complicated.
event_ref is the table containing the relations events <-> teams (One
event/multiple Teams)
Spoken: Teams or Persons organise Events,
that's what: (events.id = event_ref.event_id and event_ref.ref_id =
teams.id) is for.
Now, this search wants to be able to find all events that are
organised by teams, pers, orgs where teams,p,o name contains
"search_string".
But maybe you already brought the idea to me! Instead of using
pleanty of ORs I should try using plenty UNIONs.
Would it also possible to make multiple INTERSECTS?
How do these operate on each other, do I also use parentheses?
I am bit in a hurry, right in the moment that why I write stenograph! ;-)
Thank you in advance,
Alex
--
___________________________
Human Touch Medienproduktion GmbH
Am See 1
17440 Klein Jasedow
Alexander Lohse
Tel: (038374) 75211
Fax: (038374) 75223
eMail: al(at)humantouch(dot)de
http://www.humantouch.de
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-05-14 16:03:24 | Re: Speeding up Query |
Previous Message | webb sprague | 2001-05-14 15:40:15 | Wal logs continued... |