From 6c6ace9d23f90845fd424e474d38fe30f070775e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 8 Jan 2018 15:48:01 +0100 Subject: psql: Improve performance of record() In order to save having to always run a query to get the tablename for a known oid then we cache the result on the driver side. The oid stays the same while the table exists, so only on dropping it would it change. Recreating the table causes it to get a new oid, so there is no risk of the old one being associated with the wrong table when this happens, if the driver is still open at that point. The benchmark added shows the improvement from the previous code, before the results for PostgreSQL was: RESULT : tst_QSqlRecord::benchmarkRecord():"0_QPSQL@localhost": 259 msecs per iteration (total: 259, iterations: 1) whereas now it is: RESULT : tst_QSqlRecord::benchmarkRecord():"0_QPSQL@localhost": 0.000014 msecs per iteration (total: 59, iterations: 4194304) Task-number: QTBUG-65226 Change-Id: Ic290cff719102743da84e2044cd23e540f20c96c Reviewed-by: Christian Ehrlicher Reviewed-by: Robert Szefner Reviewed-by: Edward Welbourne --- tests/benchmarks/sql/kernel/kernel.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/benchmarks/sql/kernel/kernel.pro') diff --git a/tests/benchmarks/sql/kernel/kernel.pro b/tests/benchmarks/sql/kernel/kernel.pro index f907feeeac..63887daf5f 100644 --- a/tests/benchmarks/sql/kernel/kernel.pro +++ b/tests/benchmarks/sql/kernel/kernel.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs SUBDIRS = \ qsqlquery \ + qsqlrecord -- cgit v1.2.3