Zerofill feature of Mysql:
All rows of the field store the integer value in the same length, this feature is usable for generating invoice ID or SKU number:
create table t (t int(3) zerofill);
insert into t set t = 10;
select * from t;
+——+
| t |
+——+
| 010|
+——+
Something about Amazon SimpleDB
Sort feature added to SimpleDB. You can use the query ORDER BY. But if you want to sort the result set by a attribute , you should judge the exist of the attribute first WHERE A IS NOT NULL AND ORDER BY A DESC.
Eventual Consistency, that means when you put some data the latency maybe 1 second or longer, you can not get the data immediately.
A cache layer is needed if your system require returning result real time.
Amazon SimpleDB is a good choice for your Web application for its scalable, high avaliable, zero-configuration, schemaless. It’s ready to use. SimpleDB is written in Erlang.
Pricing
Utilization-based pricing.
No charge for up to 1GB of ingres+egress, 25 machine hours, and 1GB storage.
Performance
Average put rate: 70 singleton puts/domain/sec
Netflix staff has forklift 1 billion rows into SimpleDB with a average rate: 10-11K items/sec.
Limits
| Parameter |
Restriction |
| Domain size |
10 GB per domain |
| Domain size |
1 billion attributes per domain |
| Domain name |
3-255 characters (a-z, A-Z, 0-9, ‘_’, ‘-’, and ‘.’) |
| Domains per account |
100 |
| Attribute name-value pairs per item |
256 |
| Attribute name length |
1024 bytes |
| Attribute value length |
1024 bytes |
| Item name length |
1024 bytes |
| Attribute name, attribute value, and item name allowed characters |
All UTF-8 characters that are valid in XML documents.
Control characters and any sequences that are not valid in XML are returned Base64-encoded. For more information, see Working with XML-Restricted Characters.
|
Attributes per PutAttributes operation |
256 |
Attributes requested per Select operation |
256 |
Items per BatchPutAttributesoperation |
25 |
Maximum items in Selectresponse |
2500 |
| Maximum query execution time |
5 seconds |
Maximum number of unique attributes perSelectexpression |
20
|
Maximum number of comparisons perSelectexpression |
20
|
Maximum response size for Select |
1MB |
And not support for joins, full text search.
Query examples:
select itemName() from log where itemName() like “77-11232%”
select * from log where itemName() like “%:1169:%” order by itemName() asc
SELECT * FROM songs WHERE Year BETWEEN ’1980′ AND ’2000′
SELECT * FROM songs WHERE itemName() IS NOT NULL ORDER BY itemName() DESC
SELECT count(*) FROM songs WHERE Year < ’2000′
Firefox SimpleDB management extension:
SDB Tool: http://code.google.com/p/sdbtool/
启用了 Boost 模块缓存整个网站,或者需要在站外调用 Drupal 网站的数据,如何调用 Drupal 中的动态数据?
Ajax 调用 Drupal 中的 block 需要以下步骤
- 启动 Drupal 页面
- 动态输出 block 的内容,json 格式或者 html 格式
- 在目标页面中 Jquery 输出 Ajax 调用的数据
启动 Drupal 输出HTML格式内容
1
2
3
4
5
6
7
| <?php
// block.php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$block = module_invoke('statistics', 'block', 'view', 0);
print $block['content'];
?> |
在目标页面中 Jquery 输出 Ajax 调用的数据
1
2
3
4
| <div id="info"></div>
<script>
$('#info').load('/block.php')
</script> |