[local]/postgres=# explain analyze select * from cities order by province; 2014-06-04 20:22:16 PDT [156]DEBUG: normalization patiently waited after 5 tuples of 317102.000000 2014-06-04 20:22:16 PDT [157]DEBUG: normalization patiently waited after 10 tuples of 317102.000000 2014-06-04 20:22:16 PDT [158]DEBUG: normalization patiently waited after 20 tuples of 317102.000000 2014-06-04 20:22:16 PDT [159]DEBUG: normalization patiently waited after 40 tuples of 317102.000000 2014-06-04 20:22:16 PDT [160]DEBUG: normalization patiently waited after 80 tuples of 317102.000000 2014-06-04 20:22:16 PDT [161]DEBUG: normalization patiently waited after 160 tuples of 317102.000000 2014-06-04 20:22:16 PDT [162]DEBUG: normalization patiently waited after 320 tuples of 317102.000000 2014-06-04 20:22:16 PDT [163]DEBUG: normalization patiently waited after 640 tuples of 317102.000000 2014-06-04 20:22:16 PDT [164]DEBUG: normalization patiently waited after 1280 tuples of 317102.000000 2014-06-04 20:22:16 PDT [165]DEBUG: normalization patiently waited after 2560 tuples of 317102.000000 2014-06-04 20:22:16 PDT [166]DEBUG: normalization patiently waited after 5120 tuples of 317102.000000 2014-06-04 20:22:16 PDT [167]DEBUG: normalization patiently waited after 10240 tuples of 317102.000000 2014-06-04 20:22:16 PDT [168]DEBUG: normalization patiently waited after 20480 tuples of 317102.000000 2014-06-04 20:22:16 PDT [169]DEBUG: est_distinct after 40960: 771.612356 (normalized_cardinality: 0.018838, avg_len: 10.057007) 2014-06-04 20:22:16 PDT [170]DEBUG: est_distinct after 81920: 972.858977 (normalized_cardinality: 0.011876, avg_len: 10.879736) 2014-06-04 20:22:16 PDT [171]DEBUG: est_distinct after 163840: 1220.279187 (normalized_cardinality: 0.007448, avg_len: 10.611780) # Custom instrumentation: 2014-06-04 20:22:16 PDT [172]DEBUG: Final size: 2014-06-04 20:22:16 PDT [173]DEBUG: est_distinct after 317102: 3061.926996 (normalized_cardinality: 0.009656, avg_len: 9.980243) [local]/postgres=# select count(*) from (select distinct substring(strxfrm_test(province)::text from 0 for 19) from cities) i; count ------- 3085 (1 row) [local]/postgres=# explain analyze select * from cities order by city; 2014-06-04 20:22:50 PDT [192]DEBUG: normalization patiently waited after 5 tuples of 317102.000000 2014-06-04 20:22:50 PDT [193]DEBUG: normalization patiently waited after 10 tuples of 317102.000000 2014-06-04 20:22:50 PDT [194]DEBUG: normalization patiently waited after 20 tuples of 317102.000000 2014-06-04 20:22:50 PDT [195]DEBUG: normalization patiently waited after 40 tuples of 317102.000000 2014-06-04 20:22:50 PDT [196]DEBUG: normalization patiently waited after 80 tuples of 317102.000000 2014-06-04 20:22:50 PDT [197]DEBUG: normalization patiently waited after 160 tuples of 317102.000000 2014-06-04 20:22:50 PDT [198]DEBUG: normalization patiently waited after 320 tuples of 317102.000000 2014-06-04 20:22:50 PDT [199]DEBUG: normalization patiently waited after 640 tuples of 317102.000000 2014-06-04 20:22:50 PDT [200]DEBUG: normalization patiently waited after 1280 tuples of 317102.000000 2014-06-04 20:22:50 PDT [201]DEBUG: normalization patiently waited after 2560 tuples of 317102.000000 2014-06-04 20:22:50 PDT [202]DEBUG: normalization patiently waited after 5120 tuples of 317102.000000 2014-06-04 20:22:50 PDT [203]DEBUG: normalization patiently waited after 10240 tuples of 317102.000000 2014-06-04 20:22:50 PDT [204]DEBUG: normalization patiently waited after 20480 tuples of 317102.000000 2014-06-04 20:22:50 PDT [205]DEBUG: est_distinct after 40960: 34600.433476 (normalized_cardinality: 0.844737, avg_len: 9.833472) 2014-06-04 20:22:50 PDT [206]DEBUG: est_distinct after 81920: 65057.652151 (normalized_cardinality: 0.794161, avg_len: 10.482849) 2014-06-04 20:22:50 PDT [207]DEBUG: est_distinct after 163840: 123938.234807 (normalized_cardinality: 0.756459, avg_len: 10.045209) # Custom instrumentation: 2014-06-04 20:22:50 PDT [208]DEBUG: Final size: 2014-06-04 20:22:50 PDT [209]DEBUG: est_distinct after 317102: 221570.222392 (normalized_cardinality: 0.698735, avg_len: 9.925926) [local]/postgres=# select count(*) from (select distinct substring(strxfrm_test(city)::text from 0 for 19) from cities) i; count -------- 243782 (1 row) [local]/postgres=# explain analyze select * from cities order by country; 2014-06-04 20:24:26 PDT [210]DEBUG: normalization patiently waited after 5 tuples of 317102.000000 2014-06-04 20:24:26 PDT [211]DEBUG: normalization patiently waited after 10 tuples of 317102.000000 2014-06-04 20:24:26 PDT [212]DEBUG: normalization patiently waited after 20 tuples of 317102.000000 2014-06-04 20:24:26 PDT [213]DEBUG: normalization patiently waited after 40 tuples of 317102.000000 2014-06-04 20:24:26 PDT [214]DEBUG: normalization patiently waited after 80 tuples of 317102.000000 2014-06-04 20:24:26 PDT [215]DEBUG: normalization patiently waited after 160 tuples of 317102.000000 2014-06-04 20:24:26 PDT [216]DEBUG: normalization patiently waited after 320 tuples of 317102.000000 2014-06-04 20:24:26 PDT [217]DEBUG: normalization patiently waited after 640 tuples of 317102.000000 2014-06-04 20:24:26 PDT [218]DEBUG: normalization patiently waited after 1280 tuples of 317102.000000 2014-06-04 20:24:26 PDT [219]DEBUG: normalization patiently waited after 2560 tuples of 317102.000000 2014-06-04 20:24:26 PDT [220]DEBUG: normalization patiently waited after 5120 tuples of 317102.000000 2014-06-04 20:24:26 PDT [221]DEBUG: normalization patiently waited after 10240 tuples of 317102.000000 2014-06-04 20:24:26 PDT [222]DEBUG: normalization patiently waited after 20480 tuples of 317102.000000 2014-06-04 20:24:26 PDT [223]DEBUG: est_distinct after 40960: 52.313829 (normalized_cardinality: 0.001277, avg_len: 8.794238) 2014-06-04 20:24:26 PDT [224]DEBUG: est_distinct after 81920: 66.087446 (normalized_cardinality: 0.000807, avg_len: 8.103943) 2014-06-04 20:24:26 PDT [225]DEBUG: est_distinct after 163840: 89.827181 (normalized_cardinality: 0.000548, avg_len: 6.799408) # Custom instrumentation: 2014-06-04 20:24:26 PDT [226]DEBUG: Final size: 2014-06-04 20:24:26 PDT [227]DEBUG: est_distinct after 317102: 226.251465 (normalized_cardinality: 0.000713, avg_len: 8.431293) [local]/postgres=# select count(*) from (select distinct substring(strxfrm_test(country)::text from 0 for 19) from cities) i; count ------- 227 (1 row)