summaryrefslogtreecommitdiff
path: root/contrib/dblink
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-04-06 16:54:49 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-04-06 16:54:49 +0000
commit2604359251d34177a14ef58250d8b4a51d83103b (patch)
treeeaa41ae91dcea2a5eac60a3825f938aeb5dd4d8a /contrib/dblink
parentd785b39fbf74b8c120ecffc4a6cf81836bff0809 (diff)
downloadpostgresql-2604359251d34177a14ef58250d8b4a51d83103b.tar.gz
Improve hash_any() to use word-wide fetches when hashing suitably aligned
data. This makes for a significant speedup at the cost that the results now vary between little-endian and big-endian machines; which forces us to add explicit ORDER BYs in a couple of regression tests to preserve machine-independent comparison results. Also, force initdb by bumping catversion, since the contents of hash indexes will change (at least on big-endian machines). Kenneth Marshall and Tom Lane, based on work from Bob Jenkins. This commit does not adopt Bob's new faster mix() algorithm, however, since we still need to convince ourselves that that doesn't degrade the quality of the hashing.
Diffstat (limited to 'contrib/dblink')
-rw-r--r--contrib/dblink/expected/dblink.out18
-rw-r--r--contrib/dblink/sql/dblink.sql10
2 files changed, 22 insertions, 6 deletions
diff --git a/contrib/dblink/expected/dblink.out b/contrib/dblink/expected/dblink.out
index ec5284daf4..170d69c286 100644
--- a/contrib/dblink/expected/dblink.out
+++ b/contrib/dblink/expected/dblink.out
@@ -711,11 +711,19 @@ UNION
UNION
(SELECT * from dblink_get_result('dtest3') as t3(f1 int, f2 text, f3 text[]))
ORDER by f1;
-SELECT dblink_get_connections();
- dblink_get_connections
-------------------------
- {dtest1,dtest2,dtest3}
-(1 row)
+-- dblink_get_connections returns an array with elements in a machine-dependent
+-- ordering, so we must resort to unnesting and sorting for a stable result
+create function unnest(anyarray) returns setof anyelement
+language sql strict immutable as $$
+select $1[i] from generate_series(array_lower($1,1), array_upper($1,1)) as i
+$$;
+SELECT * FROM unnest(dblink_get_connections()) ORDER BY 1;
+ unnest
+--------
+ dtest1
+ dtest2
+ dtest3
+(3 rows)
SELECT dblink_is_busy('dtest1');
dblink_is_busy
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql
index 1d5f962db8..7e91e9c6db 100644
--- a/contrib/dblink/sql/dblink.sql
+++ b/contrib/dblink/sql/dblink.sql
@@ -340,7 +340,15 @@ UNION
(SELECT * from dblink_get_result('dtest3') as t3(f1 int, f2 text, f3 text[]))
ORDER by f1;
-SELECT dblink_get_connections();
+-- dblink_get_connections returns an array with elements in a machine-dependent
+-- ordering, so we must resort to unnesting and sorting for a stable result
+create function unnest(anyarray) returns setof anyelement
+language sql strict immutable as $$
+select $1[i] from generate_series(array_lower($1,1), array_upper($1,1)) as i
+$$;
+
+SELECT * FROM unnest(dblink_get_connections()) ORDER BY 1;
+
SELECT dblink_is_busy('dtest1');
SELECT dblink_disconnect('dtest1');