create table hits_10m
(
    WatchID BIGINT,
    JavaEnable SMALLINT,
    Title VARCHAR(1400),
    GoodEvent SMALLINT,
    EventTime TIMESTAMP,
    EventDate DATE,
    CounterID BIGINT,
    ClientIP BIGINT,
    RegionID BIGINT,
    UserID BIGINT,
    CounterClass TINYINT,
    OS SMALLINT,
    UserAgent SMALLINT,
    URL VARCHAR(7800),
    Referer VARCHAR(3125),
    Refresh TINYINT,
    RefererCategoryID INT,
    RefererRegionID BIGINT,
    URLCategoryID INT,
    URLRegionID BIGINT,
    ResolutionWidth INT,
    ResolutionHeight INT,
    ResolutionDepth SMALLINT,
    FlashMajor SMALLINT,
    FlashMinor SMALLINT,
    FlashMinor2 VARCHAR(256),
    NetMajor SMALLINT,
    NetMinor SMALLINT,
    UserAgentMajor INT,
    UserAgentMinor CHAR(2),
    CookieEnable SMALLINT,
    JavascriptEnable SMALLINT,
    IsMobile SMALLINT,
    MobilePhone SMALLINT,
    MobilePhoneModel VARCHAR(80),
    Params VARCHAR(2925),
    IPNetworkID BIGINT,
    TraficSourceID SMALLINT,
    SearchEngineID INT,
    SearchPhrase VARCHAR(2008),
    AdvEngineID SMALLINT,
    IsArtifical SMALLINT,
    WindowClientWidth INT,
    WindowClientHeight INT,
    ClientTimeZone INTEGER,
    ClientEventTime TIMESTAMP,
    SilverlightVersion1 SMALLINT,
    SilverlightVersion2 SMALLINT,
    SilverlightVersion3 BIGINT,
    SilverlightVersion4 INT,
    PageCharset VARCHAR(80),
    CodeVersion BIGINT,
    IsLink SMALLINT,
    IsDownload SMALLINT,
    IsNotBounce SMALLINT,
    FUniqID BIGINT,
    OriginalURL VARCHAR(8181),
    HID BIGINT,
    IsOldCounter SMALLINT,
    IsEvent SMALLINT,
    IsParameter SMALLINT,
    DontCountHits SMALLINT,
    WithHash SMALLINT,
    HitColor CHAR(1),
    LocalEventTime TIMESTAMP,
    Age SMALLINT,
    Sex SMALLINT,
    Income SMALLINT,
    Interests INT,
    Robotness SMALLINT,
    RemoteIP BIGINT,
    WindowName INT,
    OpenerName INT,
    HistoryLength SMALLINT,
    BrowserLanguage CHAR(2),
    BrowserCountry CHAR(2),
    SocialNetwork VARCHAR(128),
    SocialAction VARCHAR(128),
    HTTPError INT,
    SendTiming BIGINT,
    DNSTiming BIGINT,
    ConnectTiming BIGINT,
    ResponseStartTiming BIGINT,
    ResponseEndTiming BIGINT,
    FetchTiming BIGINT,
    SocialSourceNetworkID SMALLINT,
    SocialSourcePage VARCHAR(256),
    ParamPrice BIGINT,
    ParamOrderID VARCHAR(80),
    ParamCurrency CHAR(3),
    ParamCurrencyID INT,
    OpenstatServiceName VARCHAR(80),
    OpenstatCampaignID VARCHAR(512),
    OpenstatAdID VARCHAR(80),
    OpenstatSourceID VARCHAR(256),
    UTMSource VARCHAR(256),
    UTMMedium VARCHAR(256),
    UTMCampaign VARCHAR(407),
    UTMContent VARCHAR(256),
    UTMTerm VARCHAR(437),
    FromTag VARCHAR(428),
    HasGCLID SMALLINT,
    RefererHash BIGINT,
    URLHash BIGINT,
    CLID BIGINT, 
    UserIDHash BIGINT
);

CREATE INDEX ind_10m ON  hits_10m(CounterID, EventDate, UserIDHash, EventTime);

COPY INTO hits_10m FROM ('/opt/dump/dump_0.3/dump_hits_10m_meshed_utf8.tsv')  DELIMITERS '\t';