0

Say we have a fruits that that is having a high number of reads but also inserts though almost not update nor delete.

We have 2 columns that stores values that have a small number of options. Lets say categories[Banana, apple, orange or pear] and status[finished, ongoing, spoiled, destroyed or ok].
Finally, we have a column last name of owner.


Notes:
I am going to searchs sometimes by category and other by status.
In all cases, lastname will be used for the search.
I will always perform exact match on categories/status but start with in last name.

Ex of common queries:

SELECT * FROM fruit_table WHERE category='BANANA' and last_name LIKE 'Cool%'
SELECT * FROM fruit_table WHERE status='Spoiled'  and last_name LIKE 'Co%'
SELECT * FROM fruit_table WHERE category='BANANA' and last_name LIKE 'smith%'




How can I prepare it so we have low response time?
Will a index help(taking into account that the values in the column are not disperse at all)?
Might bitmap index help here?
What about partitioning?

Finally, Apologies about the title, I did not know how to formulate it properly.

4

1 回答 1

1
  • 位图索引对可用选择数量有限的项目有很大帮助。
  • 标准 b 树索引(或 SQL Server 中的非聚集索引)适用于 last_name 列。
    我会先做这两个,因为它们很容易,然后看看事情是如何运作的。

过早优化通常是一种不好的做法。但是,添加索引是一种无需太多努力即可提高速度的快速方法。有关 Oracle 中索引的更多信息,请阅读此问题

于 2013-04-25T13:29:07.597 回答