Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang: how to profile whether qlc:q does full table scan, key prefix scan or key lookup?

How to profile whether qlc:q does full table scan, key prefix scan or key lookup?

For instance, ets of type set with entries like {{KeyPrefix, KeySuffix}, Value} - will

qlc:q([
    {{KeyPrefix, KeySuffix}, Value} ||
    {{KeyPrefix, KeySuffix}, Value} <- ets:table(Table),
    KeyPrefix =:= Something
])

do full table scan or key prefix scan?

like image 727
trytrytry Avatar asked Apr 12 '11 13:04

trytrytry


1 Answers

You can obtain a lot of informations about your QLC expression using qlc:info/1. That may not help you determine whether a given subquery uses a full table scan or whatnot but that does give you back the query plan and the tables related to your query, which you can then pass to ets:info/1 to retrieve their type and keypos.

like image 123
nox Avatar answered Oct 24 '22 00:10

nox