修复错误多列索引顺序导致大数据查询效率低下问题
This commit is contained in:
parent
768e24368c
commit
f86d848b98
@ -55,7 +55,7 @@ class DbBarData(Document):
|
|||||||
meta = {
|
meta = {
|
||||||
"indexes": [
|
"indexes": [
|
||||||
{
|
{
|
||||||
"fields": ("datetime", "interval", "symbol", "exchange"),
|
"fields": ("symbol", "exchange", "interval", "datetime"),
|
||||||
"unique": True,
|
"unique": True,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -150,7 +150,7 @@ class DbTickData(Document):
|
|||||||
meta = {
|
meta = {
|
||||||
"indexes": [
|
"indexes": [
|
||||||
{
|
{
|
||||||
"fields": ("datetime", "symbol", "exchange"),
|
"fields": ("symbol", "exchange", "datetime"),
|
||||||
"unique": True,
|
"unique": True,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -82,7 +82,7 @@ def init_models(db: Database, driver: Driver):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
database = db
|
database = db
|
||||||
indexes = ((("datetime", "interval", "symbol", "exchange"), True),)
|
indexes = ((("symbol", "exchange", "interval", "datetime"), True),)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_bar(bar: BarData):
|
def from_bar(bar: BarData):
|
||||||
@ -194,7 +194,7 @@ def init_models(db: Database, driver: Driver):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
database = db
|
database = db
|
||||||
indexes = ((("datetime", "symbol", "exchange"), True),)
|
indexes = ((("symbol", "exchange", "datetime"), True),)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_tick(tick: TickData):
|
def from_tick(tick: TickData):
|
||||||
|
Loading…
Reference in New Issue
Block a user