Created
January 27, 2012 21:31
-
-
Save z4y4ts/1691021 to your computer and use it in GitHub Desktop.
How to join tables on regex — performance test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=0.00..6275.34 rows=882 width=163) (actual time=0.448..1058.363 rows=75615 loops=1) | |
Join Filter: (((msg.src_addr)::text ~~ (('380'::text || (mnc.code)::text) || '%'::text)) OR ((msg.dst_addr)::text ~~ (('380'::text || (mnc.code)::text) || | |
-> Seq Scan on sms_mobilenetworkcode mnc (cost=0.00..1.18 rows=1 width=7) (actual time=0.014..0.042 rows=12 loops=1) | |
Filter: (length((code)::text) = 2) | |
-> Seq Scan on messages msg (cost=0.00..4064.76 rows=88376 width=159) (actual time=0.005..16.282 rows=88382 loops=12) | |
Total runtime: 1064.521 ms | |
(6 rows) | |
Time: 1069.885 ms | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=0.00..5833.46 rows=442 width=163) (actual time=1.122..3319.321 rows=75615 loops=1) | |
Join Filter: ((((msg.src_addr)::text || '+'::text) || (msg.dst_addr)::text) ~ ('380'::text || (mnc.code)::text)) | |
-> Seq Scan on sms_mobilenetworkcode mnc (cost=0.00..1.18 rows=1 width=7) (actual time=0.013..0.048 rows=12 loops=1) | |
Filter: (length((code)::text) = 2) | |
-> Seq Scan on messages msg (cost=0.00..4064.76 rows=88376 width=159) (actual time=0.006..18.095 rows=88382 loops=12) | |
Total runtime: 3325.756 ms | |
(6 rows) | |
Time: 3336.726 ms | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=1.13..237378.53 rows=530256 width=163) (actual time=0.222..12925.048 rows=75615 loops=1) | |
Join Filter: (SubPlan 1) | |
-> Seq Scan on messages msg (cost=0.00..4064.76 rows=88376 width=159) (actual time=0.007..29.841 rows=88382 loops=1) | |
-> Materialize (cost=1.13..1.25 rows=12 width=7) (actual time=0.000..0.002 rows=12 loops=88382) | |
-> Seq Scan on sms_mobilenetworkcode mnc (cost=0.00..1.12 rows=12 width=7) (actual time=0.002..0.004 rows=12 loops=1) | |
SubPlan 1 | |
-> Function Scan on regexp_matches x (cost=0.00..0.20 rows=1 width=0) (actual time=0.011..0.011 rows=0 loops=1060584) | |
Filter: (y[1] = ($0)::text) | |
Total runtime: 12938.736 ms | |
(9 rows) | |
Time: 12958.897 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment