diff options
author | Jochen Topf <jochen@topf.org> | 2010-11-14 00:56:15 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2010-11-14 00:56:15 +0100 |
commit | 626e8a38ec2610197ff96252cd1110389021d698 (patch) | |
tree | fb4ff46ff3b6553b0b5fa4b6d00c4ce67d69381a /sources/db | |
parent | bcae4dba9ec66d224e3fe0da845a76dd1c6c19a2 (diff) | |
download | taginfo-626e8a38ec2610197ff96252cd1110389021d698.tar taginfo-626e8a38ec2610197ff96252cd1110389021d698.tar.gz |
new prevalent_values table
Diffstat (limited to 'sources/db')
-rw-r--r-- | sources/db/post.sql | 7 | ||||
-rw-r--r-- | sources/db/pre.sql | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sources/db/post.sql b/sources/db/post.sql index e824c48..ca6095b 100644 --- a/sources/db/post.sql +++ b/sources/db/post.sql @@ -59,6 +59,13 @@ UPDATE keys SET prevalent_values=( ) ) WHERE values_all < 1000; +INSERT INTO prevalent_values (key, value, count, fraction) + SELECT t.key, t.value, t.count_all, CAST(t.count_all AS REAL) / CAST(k.count_all AS REAL) FROM tags t, keys k + WHERE t.key = k.key + AND t.count_all > k.count_all / 100.0; + +CREATE INDEX prevalent_values_key_idx ON prevalent_values (key); + ANALYZE; UPDATE source SET update_end=datetime('now'); diff --git a/sources/db/pre.sql b/sources/db/pre.sql index 38ec051..b91e31e 100644 --- a/sources/db/pre.sql +++ b/sources/db/pre.sql @@ -34,6 +34,15 @@ CREATE TABLE keys ( prevalent_values TEXT ); +DROP TABLE IF EXISTS prevalent_values; +CREATE TABLE prevalent_values ( + key TEXT, + value TEXT, + count INTEGER, + fraction REAL +); + + DROP TABLE IF EXISTS key_distributions; CREATE TABLE key_distributions ( |