simple query is too slow 645.63ms <->1500.00ms
Hey, I'm facing performance issue due to below query.
select
*
from
"res_users"
where
"id" = 2
limit
1
Note: res_users contians only two rows
Telescope Query Details
- Location: public\index.php:52
- Duration: 645.63ms
- Tags: slow
Environment
- Laravel Framework: 9.19
- Database : PostgreSQL hosted on Amazon RDS
probably down to network rather than query execution time
how does it behave from a database management tool?
@Snapey
I guess it's not a database issue.
Run time about 40 msec when I run the query from pgAdmin 4
@alhawaj if it's the very first query, the connection time is counted as part of that query
@Sinnbeck
Telescope showing this sequence :
- query 7 slow ~ 910.93ms (tenant connection postgres DB )
- query 6 ~ 0.67ms (central connection mysql DB)
- query 5 ~ 1.44ms (central connection mysql DB)
- query 4 ~ 0.84ms (central connection mysql DB)
- query 3 ~ 0.70ms (central connection mysql DB)
- query 2 ~ 0.67ms (central connection mysql DB)
- query 1 ~ 2.82ms (central connection mysql DB)
I'm not sure if changing the connection from mysql to postgres is the reason for this issue :(
@alhawaj oh so it's on a different server and sql type? Why use two different?
@Sinnbeck
Yes. we are using a Multi-tenant SaaS database tenancy patterns.
where all tenants information are stored in the central database (mysql)
whenever a user visit his subdomain we get his information from the central database and bootstrap his own database (postgres).
Please or to participate in this conversation.