Subject Re: [firebird-support] Partial update
Author Dimitry Sibiryakov
14.02.2017 16:21, 'Leyne, Sean' Sean@... [firebird-support] wrote:
> If you are using UPDATE, then is it not reasonable to expect that you would know what the
> original values for of each field?

It is not reasonable: I have no way to know them. All I have at hand is new values for
some (not all) fields. For example, you have a table with 10 fields. And you got following
1) Change value of field1 to 10;
2) Change value of field2 to 20;
3) Change value of field3 to 30;
... and so on.

These instructions are coming one-by-one and must be executed immediately. What would
you do? Construct queried ad-hock, right? Simple solution, bad performance.

> If not, what is the "real cost" (time) of preparing statement?

It is unpredictable and for update of single record used to be bigger than execute time.

> Must a statement with parameters be prepared before it can be executed via the client?


> Cus, it seems that what you are asking the engine to maintain a cache of previously executed statements.

No. All I would like to ask for - to skip assignment of new values for those fields
that are not provided in my data message.

> So if you execute any un-prepared statements, the engine would compare the SQL text against the cache list and re-use the previously prepared version, instead of preparing the statement a new -- thus bypassing the "prepare" stage.
> Is that the real issue, you want to eliminate the "prepare" stage?

"Prepare" does much more than just parsing of query and building plan. It also check
for permissions and this stage cannot be cached.