Friday, September 30, 2016

Index column order affect Index seek or scan

Cols
  1   2   3
-------------
|   | 1 |   |
| A |---|   |
|   | 2 |   |
|---|---|   |
|   |   |   |
|   | 1 | 9 |
| B |   |   |
|   |---|   |
|   | 2 |   |
|   |---|   |
|   | 3 |   |
|---|---|   |
See how restricting on A first, as your first column eliminates more results than restricting on your second column first? It's easier if you picture how the index must be traversed across, column 1, then column 2, etc...you see that lopping off most of the results in the fist pass makes the 2nd step that much faster.
Another case, if you queried on column 3, the optimizer wouldn't even use the index, because it's not helpful at all in narrowing down the result sets. Anytime you're in a query, narrowing down the number of results to deal with before the next step means better performance.
Since the index is also stored this way, there's no backtracking across the index to find the first column when you're querying on it.
In short: No, it's not for show, there are real performance benefits.

Wednesday, September 28, 2016

合理价层次与看法

如果你有留意股市,你会发觉股价都会分成三个层次。

1. 比合理价低
2. 合理价
3. 比合理价高

而这三种股价又出现在三种股市的趋势里。

1. 熊市
2. 平稳
3. 牛市

所以买股,最重要就是要了解你买的公司的性质,不然你就会有一种捉龟跑鄨的感觉。

可能你会问什么是合理价?合理价有可以分成三种看法

1. 实质分析
根据市场先生的说法,就是把整间公司清盘了,就是它的合理价。合理价再减30%的折扣,防止意想不到的损失或亏损,这个价位就可以买入了。

2. 赚益分析
这种说法就是如果公司每年的赚益有超过其他的投资,这个价位就可以买入。比方,你用一元买,一年它赚一角,那么它的赚益就是10%,本益比就是10。如果,你在市场上,比方做生意还是买卖房产都无法赚取这样的赚益,那么这个投资就是适合你了。

3. 股息分析
这种说法就是不看公司的赚益,单看股息的发派。如果你用一元买,每年公司发放5分的股息。那么你的回酬就是5%。如果你找不到银行利息或其他的投资让你享有5%的回酬,那么这个投资就是适合你了。

当你了解了合理价,你就要考虑到时机了,因为你要把你的盈利放到最大。所以,你就要在三种趋势里分类出公司的性质。或许我简单的说说,让你明白一下。

1. 高股息优质股。
熊市>比合理价高一点或低一点
平稳>比合理价高一点
牛市》比合理价高一点

2. 成长性优质股
熊市>比合理价低一点
平稳>比合理价高
牛市》比合理价高很多

3。 投机性股
熊市>比合理价低很多
平稳>合理价或高或低,看个股
牛市》比合理价高很多

4. 垃圾股
没有合理价,纯粹赌运。