I wrote:
> "Guillaume Smet" <guillaume.smet@gmail.com> writes:
>> [ bad estimate for LIKE ]
> Hmmm ... what locale are you working in? I notice that the range
> estimator for this pattern would be "ancestors >= '1062/' AND
> ancestors < '10620'", which will do the right thing in C locale
> but maybe not so much elsewhere.
I've applied a patch that might help you:
http://archives.postgresql.org/pgsql-committers/2007-11/msg00104.php
regards, tom lane