On Mon, Apr 14, 2008 at 11:21:58AM +0200, Harald Fuchs wrote: > I think there's something sub-optimal with generate_series. > In the following, "documents" is a table with more than 120000 rows, > vacuumed and analyzed before the queries. > Since generate_series is a builtin function, can't it tell how many > rows it will return? i think it would be better off not to limit some functionality for builtin functions. it would be much nicer to have the ability to hint planer about rowcount from function *in* the sql. something like: select i from generate_series(1,10) {hint:10} as i; i'm not proposiung syntax. i'm suggesting the functionality. depesz -- quicksil1er: "postgres is excellent, but like any DB it requires a highly paid DBA. here's my CV!" :) http://www.depesz.com/ - blog dla ciebie (i moje CV)