Emre Hasegeli <e...@hasegeli.com> writes: > [ inet-selfuncs-v14.patch ]
After further reflection I concluded that the best way to deal with the O(N^2) runtime problem for the join selectivity function was to set a limit on the number of statistics values we'd consider, as was discussed awhile back IIRC. We can easily consider just the first N values of the MCV arrays, since those are sorted by decreasing frequency anyway. For the histogram arrays, taking every K'th value seems like the thing to do. I made the limit be 1024 elements as that seemed to give an acceptable maximum runtime (a couple hundred msec on my machine). We could probably reduce that if anyone feels the max runtime needs to be less. I had to drop the idea of breaking out of the histogram loop early as that didn't play nicely with the decimation logic, unfortunately. Anyway, pushed. Thanks for your perseverance on this! regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers