From: | M Tarkeshwar Rao <m(dot)tarkeshwar(dot)rao(at)ericsson(dot)com> |
---|---|
To: | Reid Thompson <Reid(dot)Thompson(at)omnicell(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Can you please tell us how set this prefetch attribute in following lines. |
Date: | 2019-10-30 16:47:27 |
Message-ID: | VI1PR0701MB27185BEBA24EC468A2606547AE600@VI1PR0701MB2718.eurprd07.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers pgsql-performance |
Thanks Thompson. Your inputs are very valuable and we successfully implemented it and results are very good.
But I am getting following error message. Can you please suggest why this is coming and what is the remedy for this.
Error Details
-----------------
Failed to execute the sql command close:
mycursor_4047439616_1571970686004430275FATAL: terminating connection due to conflict with recovery
DETAIL: User query might have needed to see row versions that must be removed.
HINT: In a moment you should be able to reconnect to the database and repeat your command.
Regards
Tarkeshwar
-----Original Message-----
From: Reid Thompson <Reid(dot)Thompson(at)omnicell(dot)com>
Sent: Thursday, October 17, 2019 9:49 PM
To: pgsql-general(at)lists(dot)postgresql(dot)org
Cc: Reid Thompson <Reid(dot)Thompson(at)omnicell(dot)com>
Subject: Re: Can you please tell us how set this prefetch attribute in following lines.
On Thu, 2019-10-17 at 11:16 +0000, M Tarkeshwar Rao wrote:
> [EXTERNAL SOURCE]
>
>
>
> Hi all,
>
> How to fetch certain number of tuples from a postgres table.
>
> Same I am doing in oracle using following lines by setting prefetch attribute.
>
> For oracle
> // Prepare query
> if( OCIStmtPrepare( myOciStatement, myOciError, (text
> *)aSqlStatement, // Get statement type OCIAttrGet( (void
> *)myOciStatement, OCI_HTYPE_STMT, &statement_type, 0, OCI_ATTR_STMT_TYPE, myOciError );
> // Set prefetch count
> OCIAttrSet( myOciStatement, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, myOciError );
> // Execute query
> status = OCIStmtExecute( myOciServerCtx, myOciStatement, myOciError,
> iters, 0, NULL, NULL, OCI_DEFAULT );
>
>
> For Postgres
>
> Can you please tell us how set this prefetch attribute in following lines. Is PQexec returns all the rows from the table?
>
> mySqlResultsPG = PQexec(connection, aSqlStatement);
> if((PQresultStatus(mySqlResultsPG) == PGRES_FATAL_ERROR ) ||
> (PQstatus(connection) != CONNECTION_OK)){} if ((PQresultStatus(mySqlResultsPG) == PGRES_COMMAND_OK) || (PQresultStatus(mySqlResultsPG) == PGRES_TUPLES_OK))
> {
> myNumColumns = PQnfields(mySqlResultsPG);
> myTotalNumberOfRowsInQueryResult = PQntuples(mySqlResultsPG);
> myCurrentRowNum = 0 ;
> }
>
>
> Regards
> Tarkeshwar
>
declare a cursor and fetch
From | Date | Subject | |
---|---|---|---|
Next Message | Fabio Ugo Venchiarutti | 2019-10-30 16:51:13 | Re: Automatically parsing in-line composite types |
Previous Message | Mitar | 2019-10-30 16:15:22 | Re: Automatically parsing in-line composite types |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2019-10-30 16:48:37 | Re: Proposal: Global Index |
Previous Message | Melanie Plageman | 2019-10-30 16:24:32 | Re: Parallel leader process info in EXPLAIN |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2019-10-30 22:31:44 | Re: GIN index on JSONB not used due to lack of nested statistics |
Previous Message | Alessandro Baretta | 2019-10-30 16:24:36 | GIN index on JSONB not used due to lack of nested statistics |