public inbox for [email protected]  
help / color / mirror / Atom feed
From: Guyren Howe <[email protected]>
To: Krishnakant Mane <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: can stored procedures with computational sql queries improve API performance?
Date: Tue, 9 Jul 2024 19:38:37 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On 7/10/24 06:44, Guyren Howe wrote:
>> On Jul 9, 2024, at 17:58, Krishnakant Mane <[email protected]> wrote:
>>> Hello.
>>> 
>>> I have a straight forward question, but I am just trying to analyze the specifics.
>>> 
>>> So I have a set of queries depending on each other in a sequence to compute some results for generating financial report.
>>> 
>>> It involves summing up some amounts from tuns or of rows and also on certain conditions it categorizes the amounts into types (aka Debit Balance, Credit balance etc).
>>> 
>>> There are at least 6 queries in this sequence and apart from 4 input parameters. these queries never change.
>>> 
>>> So will I get any performance benefit by having them in a stored procedure rather than sending the queries from my Python based API?
>> Almost certainly.
>> 
>> Doing it all in a stored procedure or likely even better a single query will remove all of the latency involved in going back and forth between your app and the database.
>> 
>> Insofar as the queries you are running separately access similar data, a single query will be able to do that work once.
>> 
>> There are other potential benefits (a smaller number of queries reduces planning time, for example).
> 
> 
> Basically there are if else conditions and it's not just the queries but the conditional sequence in which they execute.
> 
> So one single query won't do the job.

You might be surprised what you can do in one query. Feel free to share.







view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: can stored procedures with computational sql queries improve API performance?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox