> Also, this is important, have you anayzed the table? I'm guessing no,
> since the estimates are 1,000 rows, but the has join is getting a little
> bit more than that. :)
>
> Analyze your database and then run the query again.
I analyze the table and it decrease number of rows in nested loop on query plan.
Then it stuck or could be timeout when I execute the query.
This work around to optimize the database seems not helping to cut the
query time.
What about table partition? anyone know about it?