Demo Project for Raw Timings of 'Prepared' Statements

From OpenPetra Wiki
Revision as of 15:10, 20 July 2020 by Christiankatict (talk | contribs) (Created page with "MorayH wrote to ChristianK on Dec. 9th, 2016 about a demo project that he had created to compare timings of 'prepared' vs. 'non-prepared' statements. "I created a project for...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MorayH wrote to ChristianK on Dec. 9th, 2016 about a demo project that he had created to compare timings of 'prepared' vs. 'non-prepared' statements.

"I created a project for testing parameterized and prepared queries, and just for fun ran some tests using the query from csharp\ICT\Petra\Server\sql\Partner.CommonAddressTools.GetBestAddress.sql in its more complex form returning partner details as well (from csharp\ICT\Petra\Server\lib\MPartner\Common\AddressTools.cs lines 156-160). I ran it over result sets of 10, 1000 and 10,000 partners, for each result set running it as a non-prepared parameterized query iterating through the result set; then a prepared parameterized query iterating through the result set; and finally as a single query replacing the parameter with the list of partner keys given as a string in the main query.

Single query, at under half a second, is still the fastest by far, but the prepared query isn’t too far behind. Most interesting is to see how the gap between unprepared and prepared widens much faster than between prepared and single as the result set gets larger."

Demo Project - Query Timings with Prepared vs. Unprepared SQL Statements.png