Re: Delaying the planning of unnamed statements until Bind
От | Greg Stark |
---|---|
Тема | Re: Delaying the planning of unnamed statements until Bind |
Дата | |
Msg-id | 871xldq9oy.fsf@stark.xeocode.com обсуждение исходный текст |
Ответ на | Re: Delaying the planning of unnamed statements until Bind (Greg Stark <gsstark@mit.edu>) |
Список | pgsql-hackers |
Greg Stark <gsstark@MIT.EDU> writes: > Tom Lane <tgl@sss.pgh.pa.us> writes: > > > select * from mytable where entry_time >= $1; > > > > The planner will take a seqscan when it sees this because it is worried > > about the downside if a large fraction of the table is being selected. I'll mention another factor that's hidden here: The type of application that cares about parse/optimization time enough and cares about plan stability enough to reuse plans would be an OLTP application. The type of application that would want to delay optimization until the parameters are known to provide the best plan would be a DSS application or ad-hoc query. So the very fact that the user is using placeholders like this is evidence that the optimizer should err in the direction of assuming quick, very selective queries. If the specific value of $1 would help a large ad-hoc batch report run quicker the user always has the option of providing it. The OLTP application running thousands of queries per second doesn't have the option of doing that without a serious performance hit. -- greg
В списке pgsql-hackers по дате отправления: