Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpPSy-0000R1-V3 for pgsql-zh-general@arkaria.postgresql.org; Wed, 06 Sep 2017 01:49:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpPSy-00020m-2n for pgsql-zh-general@arkaria.postgresql.org; Wed, 06 Sep 2017 01:49:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpPSp-0001lq-D0 for pgsql-zh-general@postgresql.org; Wed, 06 Sep 2017 01:49:11 +0000 Received: from m97136.mail.qiye.163.com ([220.181.97.136]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpPSi-0006OK-Ur for pgsql-zh-general@postgresql.org; Wed, 06 Sep 2017 01:49:08 +0000 Received: from [192.168.0.165] (unknown [124.127.160.226]) by smtp2 (Coremail) with SMTP id iOCowAD3wIoKVK9Zr+FPBA--.20229S2; Wed, 06 Sep 2017 09:48:59 +0800 (CST) Subject: =?UTF-8?Q?Re:__Re:_[pgsql-zh-general]_=e9=9a=8f?= =?UTF-8?B?5py65a2X56ym5Liy5Ye95pWw55qEQ+ivreiogOWunueOsA==?= To: pgsql-zh-general@postgresql.org References: <73b03cf4-2254-88be-b24c-8c17e15c56a0@163.com> From: Quan Zongliang Message-ID: <26291e49-c0d2-c4f5-f72c-cb7d3844ad29@postgresdata.com> Date: Wed, 6 Sep 2017 09:48:58 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <73b03cf4-2254-88be-b24c-8c17e15c56a0@163.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: iOCowAD3wIoKVK9Zr+FPBA--.20229S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTi6pPrUUUUU X-Originating-IP: [124.127.160.226] X-CM-SenderInfo: p2rqwzpldqwhhtxd0qxsrv3wxuhvvt1wdou0bp/1tbiYgxLGli2kXZb0wAAs+ List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-zh-general Precedence: bulk Sender: pgsql-zh-general-owner@postgresql.org 这篇博文有简单测试: https://my.oschina.net/quanzl/blog/1529438 天壤之别的性能差距 On 2017/9/5 17:11, winston cheung wrote: > 权叔有性能测试么?列一下数据啊,哈哈,学习一下。 > > > On 09/05/2017 05:01 PM, Jaimin Pan wrote: >> 试一试 >> md5(random()::text); >> >> >> select pg_backend_pid(),s,'string '|| md5(random()::text) from (select >> generate_series(2000,8000,1) s) as g; >> Time: 239.733 ms >> >> 2017-09-05 16:28 GMT+08:00 Quan Zongliang >> > >: >> >> 各位下午好 >> 邮件列表沉寂太久,激活一下大家的情绪。 >> >> 分享一个C语言实现的随机字符串函数: >> PG_FUNCTION_INFO_V1(random_string); >> Datum >> random_string(PG_FUNCTION_ARGS) >> { >>         int32 length = PG_GETARG_INT32(0); >>         int32 i; >>         const char chars[] = >> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; >>         char *result; >> >>         if (length < 0) >>                 PG_RETURN_NULL(); >> >>         if (length == 0) >>                 PG_RETURN_TEXT_P(cstring_to_text("")); >> >>         result = palloc(length + 1); >>         if (result == NULL) >>                 ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), >>                                         errmsg("out of memory"))); >> >>         for (i=0; i>         { >>                 result[i] = chars[random()%(sizeof(chars)-1)]; >>         } >>         result[i] = '\0'; >> >>         PG_RETURN_TEXT_P(cstring_to_text(result)); >> } >> >> 原文见: >> https://my.oschina.net/quanzl/blog/1529438 >> >> >> 欢迎关注我司公众号:postgresdata-news >> >> -- >> 权宗亮 >> 神州飞象(北京)数据科技有限公司 >> 我们的力量源自最先进的开源数据库PostgreSQL >> zongliang.quan@postgresdata.com >> >> >> >> >> -- >> Sent via pgsql-zh-general mailing list >> (pgsql-zh-general@postgresql.org >> ) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-zh-general >> >> >> > -- Sent via pgsql-zh-general mailing list (pgsql-zh-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-zh-general