0

How can I initialize my functions to use second database instead of the default one? I use the following code, but noticed a slower response while accessing the database.

const admin = require('firebase-admin');
admin.initializeApp({
  databaseURL: "https://newdatabaseurl"
});
var database = admin.database();

The following code responds slowly:

await database.ref("restRooms").once('value').then(async (snap) => {
     ///some code
});

Connecting to second database invokes the query slowly.

2
  • Can you clarify what "slowly" means here? Specifically: can you edit your question to show how you measured the performance, what results you got, and what you expected it to be (and based on what you have that expectation)? Commented Mar 28, 2024 at 13:23
  • slowly means when a function is called from an app, the response time is too much. Commented Apr 5, 2024 at 2:04

1 Answer 1

1

By default the functions are assigned (us-central1) region. I was getting slower response from the database which was (europe-west1) based. So when I changed the region of my function to (europe-west1), I start getting quicker response.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.