magic wrote:
Thank you about the tip with BCP, I will investigate this.
Imports done by tools for bulk imports are very fast compared to the normal route. If you don't do data processing before inserts, these tools can significantly increase performance as they bypass the whole SQL pipeline.
the problem discussed by you only occurs with imports so I'd look at these tools for these specific purposes.
Nevertheless, I'm not happy about a solution that is not based on LGP cause I want to do things with the same technology. Either LGP, or not LGP ...
I'm also not happy about the fact that LGP can't do prepared statements though ... what if you save a whole entity collection? Why can't this run through a prepared statement?
It's not that we forgot about this, we didn't implement it because it's not really useful compared to the compromises we have to make to get it implemented. The problem is that inserts and updates aren't done with the same parameters over and over again, ever insert and update can be different and is treated as such. Preparing statements only works if you use the same command over and over again, as a prepared command requires that it isn't altered otherwise it would be required to prepare it again. The problem arises to have multiple prepared commands in a list and then pick one already used or create a new one and prepare that one as well, place it in a list etc.
This requires governing and control by code overlooking the whole operation, as it is very inefficient to prepare statements which aren't re-used (as preparing takes a performance hit). It also requires that the DQE is aware of this list of commands so it won't re-create a command. This in all requires the distributed pipeline we have now to be centralized and packed together again, being able to peek into eachother's datastructures, something which we'll not do.
On several databases it's also not really a true performance enhancement because execution plans are already re-used at the RDBMS level for parametrized queries, mitigating the fact that the statement is prepared.
So to add this we would need a separate pipeline optimized for this, which first sorted the entities based on changed fields so we can create per group a command and prepare it if necessary. This can be tedious however as comparing these entities can take significant time if your entities are big. (as you have to determine the different sets of parameters).
I'm not sure if this justifies the code and if it will be any faster as it is today. Our DQEs are very fast, as well as the rest of the pipeline, as well as more and more modern databases with their execution plan caching and optimization. Creating different sets of parameters for different prepared commands (and prepare them) is also not always faster for every collection, only for big collections. I.o.w.: everything is possible to build in, the only thing is if it's of any use and that it justifies the code added, and more importantly: how to switch it on and off because as I explained above, you only want this with large(r) sets of similar entities.