Re: Bulk Inserts

2019-08-13 Thread Souvik Bhattacherjee
Best, -SB On Tue, Aug 13, 2019 at 11:08 AM Adrian Klaver wrote: > On 8/13/19 6:34 AM, Souvik Bhattacherjee wrote: > > > If the selects are returning more then one row then you are already > > > doing bulk inserts. If they are returning single rows or you want to > >

Re: Bulk Inserts

2019-08-13 Thread Souvik Bhattacherjee
ote: > On 8/10/19 7:47 PM, Souvik Bhattacherjee wrote: > > Hi Adrian, > > > > Thanks for the response. > > > > > Yes, but you will some code via client or function that batches the > > > inserts for you. > > > > Could you please elaborate

Re: Bulk Inserts

2019-08-10 Thread Souvik Bhattacherjee
> Does this appeal to you: > COPY (SELECT * FROM relation) TO ... ( https://www.postgresql.org/docs/10/sql-copy.html) Not sure if COPY can be used to transfer data between tables. On Sat, Aug 10, 2019 at 11:01 PM Rob Sargent wrote: > > > On Aug 10, 2019, at 8:47 PM, Souvi

Re: Bulk Inserts

2019-08-10 Thread Souvik Bhattacherjee
> On 8/9/19 3:06 PM, Souvik Bhattacherjee wrote: > > Hi, > > > > I'm trying to measure the performance of the following: Multiple txns > > inserting tuples into a table concurrently vs single txn doing the whole > > insertion. > > > > *new table creat

Bulk Inserts

2019-08-09 Thread Souvik Bhattacherjee
Hi, I'm trying to measure the performance of the following: Multiple txns inserting tuples into a table concurrently vs single txn doing the whole insertion. *new table created as:* create table tab2 ( id serial, attr1 integer not null, attr2 integer not null, primary key(id) ); *EXP 1: inserts

Re: Running concurrent txns and measuring the timings in Postgres

2019-07-24 Thread Souvik Bhattacherjee
I got this thing running and hopefully works as expected. The txns are stored in insert_txn1.sql, insert_txn2.sql, ... Please let me know if you find any issues with this. Script is attached. On Wed, Jul 24, 2019 at 5:11 PM Adrian Klaver wrote: > On 7/24/19 1:52 PM, Souvik Bhattacherjee wr

Re: Running concurrent txns and measuring the timings in Postgres

2019-07-24 Thread Souvik Bhattacherjee
f that helps. On Wed, Jul 24, 2019 at 4:44 PM Adrian Klaver wrote: > On 7/24/19 1:42 PM, Souvik Bhattacherjee wrote: > > > The duplicate elimination is being handled by ON CONFLICT or some > custom > > > process in the code generating the transactions? > > > >

Re: Running concurrent txns and measuring the timings in Postgres

2019-07-24 Thread Souvik Bhattacherjee
w to get that done in Postgres. I wanted to check to see if there are simpler ways to get this done in Postgres before trying out something similar to Rob's suggestion or yours. On Wed, Jul 24, 2019 at 4:12 PM Adrian Klaver wrote: > On 7/24/19 12:22 PM, Souvik Bhattacherjee wrote: > &g

Re: Running concurrent txns and measuring the timings in Postgres

2019-07-24 Thread Souvik Bhattacherjee
Wed, Jul 24, 2019 at 1:58 PM Adrian Klaver wrote: > On 7/24/19 9:54 AM, Souvik Bhattacherjee wrote: > > Hi, > > > > Is there a standard procedure to execute two or more concurrent txns at > > the same time? I understand that if we want to run concurrent txns, we

Running concurrent txns and measuring the timings in Postgres

2019-07-24 Thread Souvik Bhattacherjee
Hi, Is there a standard procedure to execute two or more concurrent txns at the same time? I understand that if we want to run concurrent txns, we need to execute them from different psql sessions. But how do we make sure that they begin execution almost at the same time. Also, I'm interested in

Re: Allocating shared memory in Postgres

2019-07-03 Thread Souvik Bhattacherjee
to it such as 1. overestimating the initial shared memory size that needs to be allocated, 2. not able to free the shared memory after use Best, -SB On Wed, Jul 3, 2019 at 4:17 PM Tom Lane wrote: > Souvik Bhattacherjee writes: > > I need to allocate shared memory in Postgres 11.0 outside t

Allocating shared memory in Postgres

2019-07-03 Thread Souvik Bhattacherjee
Hi, I need to allocate shared memory in Postgres 11.0 outside the initialization phase. In order to achieve this I have done the following: - increased the amount of shared memory by increasing the value of size in CreateSharedMemoryAndSemaphores (int port) in ipci.c. I have made sure that the am

Re: Quick hack for fetching the contents of a temp table

2019-04-23 Thread Souvik Bhattacherjee
Apr 23, 2019 at 8:38 PM Michel Pelletier wrote: > On Tue, Apr 23, 2019 at 2:56 PM Souvik Bhattacherjee > wrote: > >> Hi, >> >> I need to use the return value of the function somefunction1() to modify >> a query and execute it. >> >> While it is easy

Re: Is it possible to store the output of EXPLAIN into a table

2019-04-23 Thread Souvik Bhattacherjee
Thanks, works fine! -Souvik On Mon, Apr 22, 2019 at 12:02 PM Tom Lane wrote: > Souvik Bhattacherjee writes: > > I was just wondering if it is possible to store the output of EXPLAIN > into > > a table. > > EXPLAIN won't do that directly, but you could make a plpgs

Quick hack for fetching the contents of a temp table

2019-04-23 Thread Souvik Bhattacherjee
Hi, Is there a quick way to fetch the contents of a temp table from within postgres server code? The temp table has a single column and there is a single value in the column. Thus, I'm using the temp table as a variable to store a string. begin; create temp table mytemp(metastr char(1024)) on co

Is it possible to store the output of EXPLAIN into a table

2019-04-22 Thread Souvik Bhattacherjee
Hi, I was just wondering if it is possible to store the output of EXPLAIN into a table. create temp table mytab as (select * from (explain select * from table1 where attr = 5) t); Unfortunately, the query above does not work. Thanks, -Souvik

Re: Method to pass data between queries in a multi-statement transaction

2019-04-18 Thread Souvik Bhattacherjee
esort to locking? -SB On Thu, Apr 18, 2019 at 5:34 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Apr 18, 2019 at 9:03 AM Souvik Bhattacherjee > wrote: > >> Thanks Michel. >> >> However this only works if a is an unique attribute in the ta

Re: Method to pass data between queries in a multi-statement transaction

2019-04-18 Thread Souvik Bhattacherjee
Well the DELETE is not going to work as c.cid will error as undefined. > Yes, that's a typo. I haven't tested it out before typing; just wanted to convey the general idea. -SB On Thu, Apr 18, 2019 at 10:50 AM Adrian Klaver wrote: > On 4/17/19 5:30 PM, Souvik Bhattacherjee wrot

Re: Method to pass data between queries in a multi-statement transaction

2019-04-18 Thread Souvik Bhattacherjee
On Wed, Apr 17, 2019 at 5:30 PM Souvik Bhattacherjee > wrote: > >> > What if I need the result of the join to be stored into table3 as well >> as the tuples that participated in the query to be deleted from table1. The >> following can be done without the need to transfer v

Re: Method to pass data between queries in a multi-statement transaction

2019-04-17 Thread Souvik Bhattacherjee
One can argue here that we can use the results from table3 to perform the delete operation instead of joining again. But table3 may be subject to updates which makes the situation tricky. On Wed, Apr 17, 2019 at 8:30 PM Souvik Bhattacherjee wrote: > There are few if any situations where

Re: Method to pass data between queries in a multi-statement transaction

2019-04-17 Thread Souvik Bhattacherjee
ail.com> wrote: > > On Wed, Apr 17, 2019 at 3:04 PM Souvik Bhattacherjee > wrote: > >> Hello, >> >> I'm trying to pass some values between queries in a multi-statement >> transaction. For example, consider the following representative >> multi-statem

Method to pass data between queries in a multi-statement transaction

2019-04-17 Thread Souvik Bhattacherjee
Hello, I'm trying to pass some values between queries in a multi-statement transaction. For example, consider the following representative multi-statement transaction: begin; select * from table1 t1, table2 t2 where t1.cid = t2.cid; delete from table1 where cid in (values-to-be-populated-from-the