'nodejs oracledb performance diff by the way of binding params
I wonder if there is a performance difference between below cases.
nodejs oracledb lib - express server
connection code - 1 query, 1 connection whenever I send a query, I always make a new connection. when data returned, I cut the connection.
return new Promise( async function ( resolve, reject ) {
let result = [], conn = null
try {
conn = await oracledb.getConnection( {
} )
console.log( 'DB OPENED' )
result = await conn.execute( query, bindParams, options )
resolve( result )
} catch ( e ) {
console.log( ' ---- E: a_sendQuery ----' )
console.error( e )
console.log( ' ---- E: a_sendQuery ----' )
reject( e )
} finally {
if ( conn ) {
try {
await conn.close()
console.log( 'DB CLOSED' )
} catch ( e ) {
console.log( ' ---- E: a_sendQuery: FINALLY ----' )
console.error( e )
console.log( ' ---- E: a_sendQuery: FINALLY ----' )
}
}
}
queries are
- bind value with query (
select * from table where id = 1) - bind as bindParams (
select * from table where id = :id,let bindParams = [1])
as far as my understanding from this doc: https://www.zybuluo.com/WrRan/note/570707 it uses init query statement to boost up the performance. but I couldn't find any info about how to connect db and send query from examples. My senior said I have to fix all my code so that we can get more performance but .. I don't know. I'm not sure... does oracledb remember use init queries even connection is new..?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
