Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghHT0-0004yo-P9 for pgsql-general@arkaria.postgresql.org; Wed, 09 Jan 2019 17:16:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ghHSz-0008BO-25 for pgsql-general@arkaria.postgresql.org; Wed, 09 Jan 2019 17:16:33 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghHSy-0008BF-NN for pgsql-general@lists.postgresql.org; Wed, 09 Jan 2019 17:16:32 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghHSr-0005WT-P9 for pgsql-general@lists.postgresql.org; Wed, 09 Jan 2019 17:16:31 +0000 Received: by mail-oi1-x244.google.com with SMTP id x23so6917142oix.3 for ; Wed, 09 Jan 2019 09:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=tbnSKqNZbEsDrl6+HhwZOsTX6OpTZrlfE55DXDOLQpw=; b=qRAzu9G4JQiq/DCQpIgjz/sP3LFzw2e5JDA5XeYmBy5UwOl8e5txStUrzL/E6zYI82 S1ZajY+I/PzZFGFu5TwTvLAlcx2Cd+Z8p2302MlxIw46qws9Z805GLNkvEFBZYF65G1U tMFyxT6wuvr2537X0py5jD3I0MyqB5ykUJ5pR3JFLcKRIdgw8Q7S12U/AZ6iihPLyMhe fDBbNZvpuwtffhwn9hvIEj0WFI34gUuiYTW0QeVvlj+vSP3PwpJSvWxzrRKK8Hf837Xk fPJqJpGtdk608IKCVNVyTCwRjZqA5bLGHEMzOrN2EO5AhRAS/HzGIsGQ/1Zh1chVTGtJ mn0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=tbnSKqNZbEsDrl6+HhwZOsTX6OpTZrlfE55DXDOLQpw=; b=VyZoJ4K8Nx6TxklgkrZ8Smqvqq9lna6SV6V/RN18AbSDMLsFO58rkkHL4w1ufy/hc9 eLEKr93nm7eDzTh00XRV5pEWyLXkdQXFFOoPo3GqZJg6Cg3cf9BFON5GHrxc5hnT5Tla Majs9uJL3K23O7GULHXkuNiM/V3TDrkf1Qc313uI38gsQ/c7tETuSo4r7KTv2bmCnxlJ YOTDpl7WFkT318XTDD80Y6VZ1ALWG2H7U7pUsOOiFnZicdTYbnd4ndFYbi/suZvuPj9t xerH1OGm2dFMBMEyvCkKg5TMz45Ut2OBDxSDX1bbUqw3k1kouAvlu0mRjVQ1gg5IoPKk g3ew== X-Gm-Message-State: AJcUukfTlmOn/SpSp5Es3kvr6bduc0yEYtJZI8FJa6hv1uHUSc1REEsq 36q5//qJ3Q9r8d8EsuAWRh06tJHP X-Google-Smtp-Source: ALg8bN75lCXdk/B4v1rlQiXbc/UN++IcZ6GIP3KBjiLCYyr8ZP01tsBDmDMOvaQmqZepDU7tija5Pg== X-Received: by 2002:aca:ab53:: with SMTP id u80mr4637441oie.261.1547054183162; Wed, 09 Jan 2019 09:16:23 -0800 (PST) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id s186sm35966643oie.13.2019.01.09.09.16.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 09:16:22 -0800 (PST) Subject: Re: Pulling data from Postgres DB table for every 5 seconds. To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: Date: Wed, 9 Jan 2019 11:16:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E59D7C96BD7BA25CCFEE4D73" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E59D7C96BD7BA25CCFEE4D73 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 1/9/19 11:02 AM, github kran wrote: > > > Hi Postgres Team, > > I have an application using RDS Aurora Postgresql 9.6 version having 4 > TB of DB size. In this DB we have a table PRODUCT_INFO with around  1 > million rows and table size of 1 GB. > We are looking for a implementation where we want to pull the data in > real time for every 5 seconds from the DB > "the data".  All 1GB every 5 seconds? > ( Table mentioned above) and send it to IOT topic whenever an event > occurs for a product. ( event is any new product information or change > in the existing > product information.). > > This table has few DML operations in real time either INSERT or UPDATE > based on the productId. ( Update whenever there is a change in the > product information and INSERT when a record doesnt exists for that > product). > > We have REST API's built in the backend pulling data from this backend > RDS Aurora POSTGRES DB and used by clients. > > *_UseCase_* > We dont want clients to pull the data for every 5 seconds from DB but > rather provide a service which can fetch the data from DB in real time > and push the data to IOT topic by pulling data for every 5 seconds > from DB. > Or just a tiny subset every 5 seconds? > > *_Questions_* > 1) How can I get information by pulling from the DB every 5 seconds > without impacting the performance of the DB. > 2) What are the options I have pulling the data from this table every > 5 seconds. Does POSTGRES has any other options apart from TRIGGER ?. > > > Any ideas would be helpful. > > Thanks !! > GithubKran > -- Angular momentum makes the world go 'round. --------------E59D7C96BD7BA25CCFEE4D73 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 1/9/19 11:02 AM, github kran wrote:

Hi Postgres Team,

I have an application using RDS Aurora Postgresql 9.6 version having 4 TB of DB size. In this DB we have a table PRODUCT_INFO with around  1 million rows and table size of 1 GB.
We are looking for a implementation where we want to pull the data in real time for every 5 seconds from the DB

"the data".  All 1GB every 5 seconds?

( Table mentioned above) and send it to IOT topic whenever an event occurs for a product. ( event is any new product information or change in the existing 
product information.). 

This table has few DML operations in real time either INSERT or UPDATE based on the productId. ( Update whenever there is a change in the product information and INSERT when a record doesnt exists for that product).

We have REST API's built in the backend pulling data from this backend RDS Aurora POSTGRES DB and used by clients. 

UseCase
We dont want clients to pull the data for every 5 seconds from DB but rather provide a service which can fetch the data from DB in real time and push the data to IOT topic by pulling data for every 5 seconds from DB.

Or just a tiny subset every 5 seconds?


Questions
1) How can I get information by pulling from the DB every 5 seconds without impacting the performance of the DB.
2) What are the options I have pulling the data from this table every 5 seconds. Does POSTGRES has any other options apart from TRIGGER ?.


Any ideas would be helpful.

Thanks !!
GithubKran

--
Angular momentum makes the world go 'round.
--------------E59D7C96BD7BA25CCFEE4D73--