How to change default query plugin for views? By default Views uses 'views_plugin_query_default' plugin.
How can I alter something so that Views could use another class for building queries?

I found one good example how to write Views query plugins:
building views query plugins

But this example is for custom tables. But I need to have my own query builder for ordinary node, terms and users tables.
Firstly you will need to have defined your query plugin to Views using hook_views_plugins():

function MYMODULE_views_plugins() {
  return array(
    'query' =&gt; array(
      'myplugin' =&gt; array(
        'title' =&gt; 'My custom plugin',
        'handler' =&gt; 'MyCustomQueryClass',
      ),
    ),
  );
}


Then, you should be able to override the query class used for any of the built-in tables using hook_views_data_alter() and setting the query class key in the table base property:

function MYMODULE_views_data_alter(&amp;$data) {
    $data['node']['table']['base']['query class'] = 'myplugin';
}