Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Execution Time for Same SQL Query #7309

Open
nkch8054 opened this issue Dec 9, 2024 · 1 comment
Open

Inconsistent Execution Time for Same SQL Query #7309

nkch8054 opened this issue Dec 9, 2024 · 1 comment
Assignees
Labels

Comments

@nkch8054
Copy link

nkch8054 commented Dec 9, 2024

Issue:
When executing the same SQL query multiple times, the completion timestamps vary significantly. Even though the query is identical in each execution, the execution time changes, as shown in the image below.

image

Steps to Reproduce:
Execute the following query multiple times:
sql
Copy code
SELECT a.id, a.company_name, a.sf_account_id, a.sf_lead_id, a.sf_type, e.id, e.environment_id, e.environment_name, e.license_enabled, e.crm, e.is_sandbox, e.zip_code, ad.city, ad.state, ad.country
FROM accounts a
LEFT JOIN environments e ON e.account_id = a.id
LEFT JOIN account_addresses ad ON ad.account_id = a.id
WHERE a.id = 80;
Track the execution time for each query.
Observe the varying timestamps for each execution, even though the query remains the same.
Expected Behavior:
The execution time should be relatively consistent for the same query run multiple times under similar conditions.

Actual Behavior:
The execution time varies significantly between identical queries. This inconsistency is noticeable even when executed consecutively.

Environment:
Database Engine: PostgreSQL
Go Version: go1.22.4
GORM Version: v1.25.11
OS: windows/amd64
Additional Information:
Below is an image showing the variation in execution time for the same SQL query across multiple runs:

image

@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Dec 9, 2024
Copy link

github-actions bot commented Dec 9, 2024

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants