Total Pageviews

April 11, 2019

4/11/2019 01:13:00 PM
1)SELECT numeric_number
  FROM table_math
 WHERE numeric_number + 0 = ?
Nevertheless we can index these expressions with a function-based index if we use calculations in a smart way and transform the where clause like an equation:
2)SELECT a, b
  FROM table_math
 WHERE 3*a - b = -5
In both cases though index is there on a and b,it won't use that index,If you are frequently using these of mathematical expression better to create an index as follows i.e function based index
We just moved the table references to the one side and the constants to the other. We can then create a function-based index for the left hand side of the equation:
CREATE INDEX math ON table_math (3*a - b)
Related Posts Plugin for WordPress, Blogger...