Skip to content

Commit

Permalink
Revert "Add indices to speed up conseil" (#857)
Browse files Browse the repository at this point in the history
* Revert "Add indices to speed up conseil (#841)"

This reverts commit 0e1602f.

* Update conseil.sql

* Add updated Tables.scala file

* Update conseil.sql

* Update slick tables definitions in accord to the sql schema

Co-authored-by: PrathamRawat <[email protected]>
Co-authored-by: Ivano Pagano <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2020
1 parent da18c7c commit 9054160
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
8 changes: 3 additions & 5 deletions sql/conseil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ CREATE TABLE tezos.accounts_history (
is_activated boolean NOT NULL DEFAULT false,
is_active_baker boolean
);
CREATE INDEX ix_account_id ON tezos.accounts_history USING btree (account_id);

--
-- Name: accounts_checkpoint; Type: TABLE; Schema: tezos; Owner: -
--
Expand Down Expand Up @@ -427,9 +427,6 @@ CREATE TABLE tezos.operations (
utc_time character varying NOT NULL
);

CREATE INDEX ix_manager_pubkey ON tezos.operations USING btree (manager_pubkey);
CREATE INDEX ix_operation_group_hash ON tezos.operations USING btree (operation_group_hash);
CREATE INDEX ix_originated_contracts ON tezos.operations USING btree (originated_contracts);

--
-- Name: operations_operation_id_seq; Type: SEQUENCE; Schema: tezos; Owner: -
Expand Down Expand Up @@ -555,13 +552,14 @@ ALTER TABLE ONLY tezos.operations
--

CREATE INDEX baking_rights_level_idx ON tezos.baking_rights USING btree (level);

CREATE INDEX ix_delegate_priority ON tezos.baking_rights USING btree (delegate, priority);

--
-- Name: endorsing_rights_level_idx; Type: INDEX; Schema: tezos; Owner: -
--

CREATE INDEX endorsing_rights_level_idx ON tezos.endorsing_rights USING btree (level);
CREATE INDEX ix_delegate ON tezos.endorsing_rights USING btree (delegate);


--
Expand Down
34 changes: 14 additions & 20 deletions src/main/scala/tech/cryptonomic/conseil/tezos/Tables.scala
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,8 @@ trait Tables {
/** Database column is_active_baker SqlType(bool), Default(None) */
val isActiveBaker: Rep[Option[Boolean]] = column[Option[Boolean]]("is_active_baker", O.Default(None))

/** Index over (accountId) (database name ix_account_id) */
val index1 = index("ix_account_id", accountId)

/** Index over (blockId) (database name ix_accounts_history_block_id) */
val index2 = index("ix_accounts_history_block_id", blockId)
val index1 = index("ix_accounts_history_block_id", blockId)
}

/** Collection-like TableQuery object for table AccountsHistory */
Expand Down Expand Up @@ -967,6 +964,9 @@ trait Tables {

/** Index over (level) (database name baking_rights_level_idx) */
val index1 = index("baking_rights_level_idx", level)

/** Index over (delegate,priority) (database name ix_delegate_priority) */
val index2 = index("ix_delegate_priority", (delegate, priority))
}

/** Collection-like TableQuery object for table BakingRights */
Expand Down Expand Up @@ -1592,6 +1592,9 @@ trait Tables {

/** Index over (level) (database name endorsing_rights_level_idx) */
val index1 = index("endorsing_rights_level_idx", level)

/** Index over (delegate) (database name ix_delegate) */
val index2 = index("ix_delegate", delegate)
}

/** Collection-like TableQuery object for table EndorsingRights */
Expand Down Expand Up @@ -2388,35 +2391,26 @@ trait Tables {
onDelete = ForeignKeyAction.NoAction
)

/** Index over (managerPubkey) (database name ix_manager_pubkey) */
val index1 = index("ix_manager_pubkey", managerPubkey :: HNil)

/** Index over (operationGroupHash) (database name ix_operation_group_hash) */
val index2 = index("ix_operation_group_hash", operationGroupHash :: HNil)

/** Index over (blockLevel) (database name ix_operations_block_level) */
val index3 = index("ix_operations_block_level", blockLevel :: HNil)
val index1 = index("ix_operations_block_level", blockLevel :: HNil)

/** Index over (cycle) (database name ix_operations_cycle) */
val index4 = index("ix_operations_cycle", cycle :: HNil)
val index2 = index("ix_operations_cycle", cycle :: HNil)

/** Index over (delegate) (database name ix_operations_delegate) */
val index5 = index("ix_operations_delegate", delegate :: HNil)
val index3 = index("ix_operations_delegate", delegate :: HNil)

/** Index over (destination) (database name ix_operations_destination) */
val index6 = index("ix_operations_destination", destination :: HNil)
val index4 = index("ix_operations_destination", destination :: HNil)

/** Index over (kind) (database name ix_operations_kind) */
val index7 = index("ix_operations_kind", kind :: HNil)
val index5 = index("ix_operations_kind", kind :: HNil)

/** Index over (source) (database name ix_operations_source) */
val index8 = index("ix_operations_source", source :: HNil)
val index6 = index("ix_operations_source", source :: HNil)

/** Index over (timestamp) (database name ix_operations_timestamp) */
val index9 = index("ix_operations_timestamp", timestamp :: HNil)

/** Index over (originatedContracts) (database name ix_originated_contracts) */
val index10 = index("ix_originated_contracts", originatedContracts :: HNil)
val index7 = index("ix_operations_timestamp", timestamp :: HNil)
}

/** Collection-like TableQuery object for table Operations */
Expand Down

0 comments on commit 9054160

Please sign in to comment.