Skip to content

Commit

Permalink
fixed issue with null indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed Apr 3, 2023
1 parent 7b623d6 commit 05cbbf4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tokenomics/DDL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ create table if not exists balance_recalculation_worker
primary key (worker_index, user_id)
) partition by list (worker_index);
----
create index if not exists balance_recalculation_worker_iterator_ix ON balance_recalculation_worker(worker_index,enabled,last_iteration_finished_at);
create index if not exists balance_recalculation_worker_iterator_ix ON balance_recalculation_worker(worker_index,enabled,last_iteration_finished_at ASC NULLS first);
----
select createListWorkerPartition('balance_recalculation_worker'::text,%[1]v::smallint);
----
Expand All @@ -230,7 +230,7 @@ create table if not exists mining_rates_recalculation_worker
primary key (worker_index, user_id)
) partition by list (worker_index);
----
create index if not exists mining_rates_recalculation_worker_last_iteration_finished_at_ix ON mining_rates_recalculation_worker(worker_index,last_iteration_finished_at);
create index if not exists mining_rates_recalculation_worker_last_iteration_finished_at_ix ON mining_rates_recalculation_worker(worker_index,last_iteration_finished_at ASC NULLS first);
----
select createListWorkerPartition('mining_rates_recalculation_worker'::text,%[1]v::smallint);
----
Expand All @@ -246,7 +246,7 @@ create table if not exists blockchain_balance_synchronization_worker
primary key (worker_index, user_id)
) partition by list (worker_index);
----
create index if not exists blockchain_balance_synchronization_worker_last_iteration_finished_at_ix ON blockchain_balance_synchronization_worker(worker_index,last_iteration_finished_at);
create index if not exists blockchain_balance_synchronization_worker_last_iteration_finished_at_ix ON blockchain_balance_synchronization_worker(worker_index,last_iteration_finished_at ASC NULLS first);
----
select createListWorkerPartition('blockchain_balance_synchronization_worker'::text,%[1]v::smallint);
----
Expand Down
2 changes: 1 addition & 1 deletion tokenomics/balance_recalculation.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ SELECT b.updated_at,
FROM ( SELECT user_id
FROM balance_recalculation_worker
WHERE worker_index = $3 AND enabled = TRUE
ORDER BY last_iteration_finished_at
ORDER BY last_iteration_finished_at ASC NULLS first
LIMIT $2 ) x
JOIN (%[1]v) current_adoption
ON 1=1
Expand Down
2 changes: 1 addition & 1 deletion tokenomics/blockchain_balance_synchronization.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ FROM (SELECT DISTINCT ON (x.user_id)
mining_blockchain_account_address
FROM blockchain_balance_synchronization_worker
WHERE worker_index = $1
ORDER BY last_iteration_finished_at
ORDER BY last_iteration_finished_at ASC NULLS first
LIMIT $2 ) x
LEFT JOIN pre_stakings st
ON st.worker_index = $1
Expand Down
2 changes: 1 addition & 1 deletion tokenomics/mining_rates_recalculation.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ FROM (SELECT MAX(st.years) AS pre_staking_years,
FROM ( SELECT user_id
FROM mining_rates_recalculation_worker
WHERE worker_index = $1
ORDER BY last_iteration_finished_at
ORDER BY last_iteration_finished_at ASC NULLS first
LIMIT $2 ) x
LEFT JOIN pre_stakings st
ON st.worker_index = $1
Expand Down

0 comments on commit 05cbbf4

Please sign in to comment.