Patent Document ID: 9262457
Application ID: 13965552

Base Claim:
1. A method for creating a hash index on-demand and reusing the hash index for queries in a database, comprising: determining, by at least one processor, during query optimization that a first database query has a query execution plan comprising a sub-query which executes N times a correlated predicate having an operator being one of equal and not equal to a base column; comparing, by the at least one processor, based on the correlated predicate, a cost of creating a hash index and probing the hash index N times to a cost of fully scanning the base column N times; creating on-demand, by the at least one processor, a hash index based on the comparing; and executing, by the at least one processor, a second database query using the hash index, wherein the executing eliminates fully scanning the base column N times.

---

Claim 9:
9. The method of claim 1 , further comprising: discarding the hash index when it is determined that all database transactions using an associated table version are completed and that at least one version of the table more recent than the associated table version exists.