Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwb8H-0006Iv-W9 for pgsql-performance@arkaria.postgresql.org; Tue, 18 Oct 2016 20:37:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bwb8H-00057u-Cf for pgsql-performance@arkaria.postgresql.org; Tue, 18 Oct 2016 20:37:09 +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 1bwb6c-0003FV-CK for pgsql-performance@postgresql.org; Tue, 18 Oct 2016 20:35:26 +0000 Received: from mail-qt0-x234.google.com ([2607:f8b0:400d:c0d::234]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bwb6a-00073h-3E for pgsql-performance@postgresql.org; Tue, 18 Oct 2016 20:35:25 +0000 Received: by mail-qt0-x234.google.com with SMTP id s49so3699947qta.0 for ; Tue, 18 Oct 2016 13:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=YtgUAJ0rcHlncsLVIoUXMrj3PZZALf7MudAa9oUqXwQ=; b=L7cne+LLOnhUjKT/kZHmdN/S0cze9KbWlN4R6R3qsCOaPG5jOi4DAbJmgaKZJOuuqx +6nCU/03ot4jCkxjKVQiH1dCM4rCvRsDrI3Z/oQxCNerPC1U0WSEUN0q0TRrHNEZC0+n StfjjbjhnBGqjcn4hCaGdOW2c7PzHKKpk6E+SH/xozGG8gDNHVLP05o9+gTGhbhcA5vs dNcuo/oWaoBm0mceyrqPxJVQrel1TdVldgUtRU2kjDxumtFHSrQ70zMwHvXV0EN7ASHv vwUQIhIb5abJHdAYzfirkB5Cbng9jHmJQUd1eQwPNl/vBvfBIMvvW4OGsOic43RVtScV F3kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=YtgUAJ0rcHlncsLVIoUXMrj3PZZALf7MudAa9oUqXwQ=; b=kFa+cwlPVIFO6h1mZaBl5w8lWa5cmBpLtD6M5u4S7R2b/rKl2U+11Ysant2dDJai4s jeXxu7vZSHwOlJmHzz+kmzK0kbEm9YsiXUrTeS9jaKW7YV0vtFGiXkMNPO36KXXfSfxq F4isEf4JRRUwQ6/AaDUFqCWAe3CRDtBg++oqJs9FVIiBhMzaWJyrmPtwhXfEKRJ/rDxd MSlfwFKFjF1NuNPBzyHCiZIWg21Iz7ZuwhklKEaufFbe4B9l1oHN9t7f1pJfUWXl8KnG LlpG3eZ0NKfN/hUKZplcs/y6t0m9xS15x8NVwtRstgopU4ejOwv1KQMW/1oPnrMzgCQs aqug== X-Gm-Message-State: AA6/9Rn897nOEMqpY2vnSDMX1zAKkSYG7pw38GOI9BuVNE1MQuaZ5KIyleZRb2LO9+JSZw== X-Received: by 10.200.34.145 with SMTP id f17mr2584309qta.149.1476822922070; Tue, 18 Oct 2016 13:35:22 -0700 (PDT) Received: from [10.0.1.5] (static-71-126-153-54.washdc.fios.verizon.net. [71.126.153.54]) by smtp.gmail.com with ESMTPSA id f88sm6850330qtb.31.2016.10.18.13.35.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2016 13:35:21 -0700 (PDT) From: Bobby Mozumder Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Should I generate strings in Postgres of Python? Message-Id: <964DB65A-9A61-42EF-9803-5CE99F564727@gmail.com> Date: Tue, 18 Oct 2016 16:35:20 -0400 To: "pgsql-performance@postgresql.org" X-Mailer: Apple Mail (2.3226) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org How fast is Postgres's string concatenation in comparison to the various Py= thon string concatenation? I'm using PREPARE statements for my SELECT quer= ies for my web server. I'm wondering if I should just generate my JSON API (or even HTML) strings = in Postgres directly, instead of in Python. This would involve a few IF-TH= EN-ELSE (in Python) which I convert to CASE-WHEN (in Postgres) as well. I=E2=80=99m not sure about the internals of Postgres and how it compares sp= eedwise to the Python bytecode interpreter (and future JIT compilers like P= yPy). Is Postgres generating bytecode and interpreting that for string con= catenation & Case statements? -bobby --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance