8.2 Set Custom Schema

As explained in the Schema Management article, all tables have two fields: ‘v’ and ‘time’. In addition to these, you can set custom schema on the tables.

$ td schema:set testdb www_access action:string user:int

$ td query -w -d testdb "SELECT user, COUNT(1) AS cnt

FROM www_access

WHERE action='login'

GROUP BY user ORDER BY cnt DESC"

After setting the schema, queries issued with named columns instead of ‘v’ will use the schema information to achieve a more optimized execution path. In particular, GROUP BY performance will improve significantly.

results matching ""

    No results matching ""