1

I have a query with two tables join based on condition b.customer_id = a.customer_id, there is index(btree) on both table on both columns customer_id.

When I ran explain analyze it says 15 ms:

enter image description here

But when I execute query it took 26 secs:

Successfully run. Total query runtime: 26 secs 168 msec.
30038 rows affected.  
0

1 Answer 1

2

That is because you are using pgAdmin or a similar client tool that takes a long time to render 30038 rows.

Sign up to request clarification or add additional context in comments.

2 Comments

Then which time should be noted as actual query execution time? I got confused between query execution time in PgAdmin and Explain Analyze Execution time.
That depends on your use case. If your actual use case is to view 30000 with pgAdmin, take the 26 seconds. The execution time on the server cannot contain the network latency or the time it takes the client to process the result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.