Infrastructure at your Service

Category Archives: Postgres

Franck Pachot

Postgres vs. Oracle access paths IX – Tid Scan

By | Oracle, Postgres | No Comments

In the previous post we have seen how Postgres and Oracle finds the table row from the index entry. It uses the TID / ROWID. I’ll focus on this access path and I will have covered all Postgres access paths to table data. Oracle ACCESS BY ROWID I start with Oracle because we already have seen the TABLE ACCESS BY ROWID. I’ll decompose an index acces to the table. The first step is getting the…

 
Read More
Franck Pachot

Postgres vs. Oracle access paths VIII – Index Scan and Filter

By | Oracle, Postgres | 2 Comments

In the previous post we have seen a nice optimization to lower the consequences of bad correlation between the index and the table physical order: a bitmap, which may include false positives and then requires a ‘recheck’ of the condition, but with the goal to read each page only once. Now we are back to the well-clustered table where we have seen two possible access paths: IndexOnlyScan when all columns we need are in the…

 
Read More
Franck Pachot

Postgres vs. Oracle access paths IV – Order By and Index

By | Oracle, Postgres | No Comments

I realize that I’m talking about indexes in Oracle and Postgres, and didn’t mention yet the best website you can find about indexes, with concepts and examples for all RDBMS: http://use-the-index-luke.com. You will probably learn a lot about SQL design. Now let’s continue on execution plans with indexes. As we have seen two posts ago, an index can be used even with a 100% selectivity (all rows), when we don’t filter any rows. Oracle has…

 
Read More
Franck Pachot

Postgres vs. Oracle access paths II – Index Only Scan

By | Oracle, Postgres | No Comments

In the previous post I’ve explained a sequential scan by accident: my query needed only one column which was indexed, and I expected to read the index rather than the table. And I had to hint the Oracle example to get the same because the Oracle optimizer chooses the index scan over the table scan in that case. Here is where I learned a big difference between Postgres and Oracle. They both use MVCC to…

 
Read More
Franck Pachot

Postgres vs. Oracle access paths I – Seq Scan

By | Oracle, Postgres | 5 Comments

Here is the first test I’ve done for my Postgres vs. Oracle access paths series and the first query did a sequential scan. It illustrates the first constant you find in the documentation for the query planner: seq_page_cost (floating point) Sets the planner’s estimate of the cost of a disk page fetch that is part of a series of sequential fetches. The default is 1.0.  

 
Read More