Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avuu2-0005Y6-FT for pgsql-odbc@arkaria.postgresql.org; Thu, 28 Apr 2016 22:59:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1avuu0-0007U6-P7 for pgsql-odbc@arkaria.postgresql.org; Thu, 28 Apr 2016 22:59:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1avutd-0006e8-MG for pgsql-odbc@postgresql.org; Thu, 28 Apr 2016 22:58:57 +0000 Received: from mail1.asahi-net.or.jp ([202.224.39.197]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avutY-0005BD-Jx for pgsql-odbc@postgresql.org; Thu, 28 Apr 2016 22:58:56 +0000 Received: from [192.168.1.3] (h216161.dynamic.ppp.asahi-net.or.jp [61.114.216.161]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id DB3E41CC89; Fri, 29 Apr 2016 07:58:43 +0900 (JST) Subject: Re: [PATCH] Remove unncessary localtime() calls during data type conversion To: Michael Paquier , Heikki Linnakangas References: <557B7C76.1030502@vmware.com> <55E56BDC.8020906@iki.fi> Cc: Nikhil Deshpande , PostgreSQL mailing lists From: "Inoue, Hiroshi" Message-ID: <572295A5.4080202@dream.email.ne.jp> Date: Fri, 29 Apr 2016 07:58:45 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Hi Michael, Sorry for the late reply. On 2016/04/25 15:30, Michael Paquier wrote: > On Tue, Sep 1, 2015 at 6:11 PM, Heikki Linnakangas wrote: >> This changes behaviour, when converting from text to date column. Without >> this patch, if the string you're converting from is missing a >> year/month/date field, it will be filled with the current date. > Waking up an old thread, after being reminded by some colleagues that > there are no improvements in the upstream code yet regarding that... > >> This modification to the result-conversions test case shows the difference: >> >> --- a/test/src/result-conversions-test.c >> +++ b/test/src/result-conversions-test.c >> @@ -626,6 +626,8 @@ int main(int argc, char **argv) >> test_conversion("float8", "Infinity", SQL_C_DOUBLE, "SQL_C_DOUBLE", >> 20); >> test_conversion("float8", "-Infinity", SQL_C_DOUBLE, "SQL_C_DOUBLE", >> 20); >> >> + test_conversion("text", "", SQL_C_TYPE_DATE, "SQL_C_TYPE_DATE", 20); >> + >> /* Clean up */ >> test_disconnect(); >> >> We don't currently contain tests like that in the test suite, as mentioned >> in the comment earlier in result-conversions-test.c: > Yes, I can see the difference. I am noticing that only SQL_C_TYPE_DATE > and SQL_C_TYPE_TIMESTAMP are actually converting the non-defined > fields using the localtime values. SQL_C_TYPE_TIME is not impacted at > all. Is that expected? > >>> /* >>> * Converting arbitrary things to date and timestamp produces >>> results that >>> * depend on the current timestamp, because the driver substitutes >>> the >>> * current year/month/datefor missing values. Disable for now, to >>> get a >>> * reproducible result. >>> */ >> >> Would be nice to include those tests, perhaps by printing the difference to >> current date instead of the absolute date. > Yeah, I have done that in the attached with 0001, however I don't > really see how we can actually remove those comments, because some of > the tests include a fixed timestamp, and need to use a fixed > timestamp. > > I am attaching patch 0002 that is a rebase of the main patch for HEAD, > that introduces no regressions based on the tests I have added in > 0001. 0002 is proving to improve performance of the ODBC driver by > more or less 20% by reducing those localtime() calls in perf specs for > an application that is pretty hot with SQLFetch. That's quite > something. I would take care of the patches. Thanks. regards, Hiroshi Inoue -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc