From: | "Jerry Wintrode" <wintrojr(at)tripos(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Need another way to do this, my sql much to slow... |
Date: | 2003-11-20 16:45:43 |
Message-ID: | 4E676B0AAF74B443A18D7BC7AAB3CFFD1D44D7@s01-exch01.tripos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Let me give you a better dataset:
msg_sender_num | env_sender_num
----------------+----------------
118 | 53003
118 | 51778
118 | 49679
118 | 49457
118 | 37434
118 | 37389
118 | 33644
118 | 33609
118 | 26043
118 | 26004
118 | 24288
118 | 23357
118 | 16246
118 | 16103
118 | 12967
118 | 12140
118 | 4191
118 | 122
118 | 860
with the SQL:
SELECT record_of_claims.msg_sender_num, count(DISTINCT
record_of_claims.env_sender_num) AS env_from_claims_count FROM
record_of_claims WHERE (record_of_claims.msg_sender_num =118) GROUP BY
record_of_claims.msg_sender_num;
You get:
msg_sender_num | env_from_claims_count
----------------+-----------------------
118 | 19
Which is correct for the following reason:
msg_sender_num | envelope_from
----------------+---------------------------------------------
118 | ABVQ3QQBAQAFfLcB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFgHcB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFJkQB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFKhMB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFKhMB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFKz0B9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFKz0B9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFKiMB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFKiMB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFKxoB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFKxoB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFK0QB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFK0QB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFLuEB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFLuEB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFf8wB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFf8wB9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
118 | AjEywAQBAQAFgAoB9QAAOw4CAAAAAA(at)b(dot)tpcper(dot)com
118 | ABVQ3QQBAQAFgA4B9QAAAAACAAAAAA(at)b(dot)tpcper(dot)com
19 different envelope from names all claiming to be the same Message
from: 118 ("TopOffers TopOffers(at)Topica(dot)com")
All of the above address would be added to blacklist for 120 days.
If I say every 15 minutes or so create a new table full of the results
of the SQL view it sort of solves my problem. Still takes forever to
process but the next view that needs these results can do an index scan
on the resulting table and not have to build the list all over again. In
this was I can cut my processing time to 6/10th of a second. But I have
to create/drop/rename tables on a time interval. Not the best solution.
Jerry Wintrode
Network Administrator
Tripos, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Jerry Wintrode | 2003-11-20 23:26:00 | Re: Need another way to do this, my sql much to slow... |
Previous Message | Christoph Haller | 2003-11-20 15:38:14 | Re: Need another way to do this, my sql much to slow... |