Question

[Databases] Compare and why the two below queries plans are different after executing them?

postgres=# EXPLAIN ANALYZE SELECT sorted , rndm FROM table1 where sorted > 1999231 and rndm = 1005; QUERY PLAN Index Scan usi

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In 1st query table contains indexing column for sorted. Data 1st will be searched index column with out scanning entire table and the filter out data using rndm on table using table scan.

Where as in 2nd query table doesn't have any indexing column, so data directly will get filtered instead of index with help of where clause columns. Entire table scan will happen unlike 1st query.

Add a comment
Know the answer?
Add Answer to:
[Databases] Compare and why the two below queries plans are different after executing them? postgres=# EXPLAIN ANALYZE SELECT sorted , rndm FROM table1 where sorted > 1999231 and rndm = 1005; QUER...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT