drop table if exists orderbook_items; create table orderbook_items ( id bigserial, time timestamp default current_timestamp, figi text not null, ticker text not null, price decimal not null, count bigint not null, item_type int not null default 1, primary key (id) ); CREATE INDEX orderbook_items_index ON orderbook_items USING btree(figi, time, item_type);