From ad1328249480735318bf6e6204882fe3384367ad Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Tue, 9 Oct 2018 23:40:02 -0400 Subject: [PATCH] txo (claim_id) column index --- lbrynet/daemon/Daemon.py | 2 +- lbrynet/wallet/database.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 2d82490ac..d62cb44a7 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -92,7 +92,7 @@ def maybe_paginate(get_records: Callable, get_record_count: Callable, }) return { "items": (yield get_records(**constraints)), - "total_pages": ((yield get_record_count(**constraints)) + (page_size-1)) / page_size, + "total_pages": int(((yield get_record_count(**constraints)) + (page_size-1)) / page_size), "page": page, "page_size": page_size } return (yield get_records(**constraints)) diff --git a/lbrynet/wallet/database.py b/lbrynet/wallet/database.py index 091e71c04..5ac5f4cfe 100644 --- a/lbrynet/wallet/database.py +++ b/lbrynet/wallet/database.py @@ -22,13 +22,17 @@ class WalletDatabase(BaseDatabase): is_buy boolean not null default 0, is_sell boolean not null default 0 ); + create index txo_claim_id_idx on txo (claim_id); """ CREATE_TABLES_QUERY = ( BaseDatabase.CREATE_TX_TABLE + BaseDatabase.CREATE_PUBKEY_ADDRESS_TABLE + + BaseDatabase.CREATE_PUBKEY_ADDRESS_INDEX + CREATE_TXO_TABLE + - BaseDatabase.CREATE_TXI_TABLE + BaseDatabase.CREATE_TXO_INDEX + + BaseDatabase.CREATE_TXI_TABLE + + BaseDatabase.CREATE_TXI_INDEX ) def txo_to_row(self, tx, address, txo):