首页 > 其他分享 >monodb4.4 index《二》

monodb4.4 index《二》

时间:2023-04-05 10:06:48浏览次数:40  
标签:username index false age monodb4.4 索引 quantity stage

1.使用复合索引

(1).索引的方向

2个字段都按照升序

{"age" : 1, "username" : 1}

age按照升序,username按照降序

{"age" : 1, "username" : -­1}

以下2个索引是一样的

{"age" : 1, "username" : ­-1}
{"age" : -­1, "username" : 1}
(2).使用覆盖索引(COVERED INDEXES)

覆盖索引就是只使用索引字段返回数据,具体例子如下:

首先查询当前表上的索引

wang> db.users.getIndexes()
[
        {
                "v" : 2,
                "key" : {
                        "_id" : 1
                },
                "name" : "_id_"
        },
        {
                "v" : 2,
                "key" : {
                        "username" : 1
                },
                "name" : "username_1"
        },
        {
                "v" : 2,
                "key" : {
                        "age" : 1,
                        "username" : 1
                },
                "name" : "age_1_username_1"
        }
]
wang> 

使用覆盖索引进行查询

重点关注stage为IXSCAN,在executionStats中,totalDocsExamined为0表示就是使用了覆盖索引

wang> db.users.find({age:21,username:'user997679'},{age:1,username:1,_id:0}).explain("executionStats")
{
        "queryPlanner" : {
                "plannerVersion" : 1,
                "namespace" : "wang.users",
                "indexFilterSet" : false,
                "parsedQuery" : {
                        "$and" : [
                                {
                                        "age" : {
                                                "$eq" : 21
                                        }
                                },
                                {
                                        "username" : {
                                                "$eq" : "user997679"
                                        }
                                }
                        ]
                },
                "winningPlan" : {
                        "stage" : "PROJECTION_COVERED",
                        "transformBy" : {
                                "age" : 1,
                                "username" : 1,
                                "_id" : 0
                        },
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "keyPattern" : {
                                        "age" : 1,
                                        "username" : 1
                                },
                                "indexName" : "age_1_username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "age" : [ ],
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "age" : [
                                                "[21.0, 21.0]"
                                        ],
                                        "username" : [
                                                "[\"user997679\", \"user997679\"]"
                                        ]
                                }
                        }
                },
                "rejectedPlans" : [
                        {
                                "stage" : "PROJECTION_SIMPLE",
                                "transformBy" : {
                                        "age" : 1,
                                        "username" : 1,
                                        "_id" : 0
                                },
                                "inputStage" : {
                                        "stage" : "FETCH",
                                        "filter" : {
                                                "age" : {
                                                        "$eq" : 21
                                                }
                                        },
                                        "inputStage" : {
                                                "stage" : "IXSCAN",
                                                "keyPattern" : {
                                                        "username" : 1
                                                },
                                                "indexName" : "username_1",
                                                "isMultiKey" : false,
                                                "multiKeyPaths" : {
                                                        "username" : [ ]
                                                },
                                                "isUnique" : false,
                                                "isSparse" : false,
                                                "isPartial" : false,
                                                "indexVersion" : 2,
                                                "direction" : "forward",
                                                "indexBounds" : {
                                                        "username" : [
                                                                "[\"user997679\", \"user997679\"]"
                                                        ]
                                                }
                                        }
                                }
                        }
                ]
        },
        "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 1,
                "executionTimeMillis" : 0,
                "totalKeysExamined" : 1,
                "totalDocsExamined" : 0,
                "executionStages" : {
                        "stage" : "PROJECTION_COVERED",
                        "nReturned" : 1,
                        "executionTimeMillisEstimate" : 0,
                        "works" : 3,
                        "advanced" : 1,
                        "needTime" : 0,
                        "needYield" : 0,
                        "saveState" : 0,
                        "restoreState" : 0,
                        "isEOF" : 1,
                        "transformBy" : {
                                "age" : 1,
                                "username" : 1,
                                "_id" : 0
                        },
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "nReturned" : 1,
                                "executionTimeMillisEstimate" : 0,
                                "works" : 3,
                                "advanced" : 1,
                                "needTime" : 0,
                                "needYield" : 0,
                                "saveState" : 0,
                                "restoreState" : 0,
                                "isEOF" : 1,
                                "keyPattern" : {
                                        "age" : 1,
                                        "username" : 1
                                },
                                "indexName" : "age_1_username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "age" : [ ],
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "age" : [
                                                "[21.0, 21.0]"
                                        ],
                                        "username" : [
                                                "[\"user997679\", \"user997679\"]"
                                        ]
                                },
                                "keysExamined" : 1,
                                "seeks" : 1,
                                "dupsTested" : 0,
                                "dupsDropped" : 0
                        }
                }
        },
        "serverInfo" : {
                "host" : "localhost.localdomain",
                "port" : 27017,
                "version" : "4.4.0",
                "gitVersion" : "563487e100c4215e2dce98d0af2a6a5a2d67c5cf"
        },
        "ok" : 1
}
wang> 

以下方式就是没有使用到覆盖索引(虽然stage为IXSCAN,但是totalDocsExamined不为0)

wang> db.users.find({age:21,username:'user997679'}).explain("executionStats")
{
        "queryPlanner" : {
                "plannerVersion" : 1,
                "namespace" : "wang.users",
                "indexFilterSet" : false,
                "parsedQuery" : {
                        "$and" : [
                                {
                                        "age" : {
                                                "$eq" : 21
                                        }
                                },
                                {
                                        "username" : {
                                                "$eq" : "user997679"
                                        }
                                }
                        ]
                },
                "winningPlan" : {
                        "stage" : "FETCH",
                        "filter" : {
                                "age" : {
                                        "$eq" : 21
                                }
                        },
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "keyPattern" : {
                                        "username" : 1
                                },
                                "indexName" : "username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "username" : [
                                                "[\"user997679\", \"user997679\"]"
                                        ]
                                }
                        }
                },
                "rejectedPlans" : [
                        {
                                "stage" : "FETCH",
                                "inputStage" : {
                                        "stage" : "IXSCAN",
                                        "keyPattern" : {
                                                "age" : 1,
                                                "username" : 1
                                        },
                                        "indexName" : "age_1_username_1",
                                        "isMultiKey" : false,
                                        "multiKeyPaths" : {
                                                "age" : [ ],
                                                "username" : [ ]
                                        },
                                        "isUnique" : false,
                                        "isSparse" : false,
                                        "isPartial" : false,
                                        "indexVersion" : 2,
                                        "direction" : "forward",
                                        "indexBounds" : {
                                                "age" : [
                                                        "[21.0, 21.0]"
                                                ],
                                                "username" : [
                                                        "[\"user997679\", \"user997679\"]"
                                                ]
                                        }
                                }
                        }
                ]
        },
        "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 1,
                "executionTimeMillis" : 0,
                "totalKeysExamined" : 1,
                "totalDocsExamined" : 1,
                "executionStages" : {
                        "stage" : "FETCH",
                        "filter" : {
                                "age" : {
                                        "$eq" : 21
                                }
                        },
                        "nReturned" : 1,
                        "executionTimeMillisEstimate" : 0,
                        "works" : 3,
                        "advanced" : 1,
                        "needTime" : 0,
                        "needYield" : 0,
                        "saveState" : 0,
                        "restoreState" : 0,
                        "isEOF" : 1,
                        "docsExamined" : 1,
                        "alreadyHasObj" : 0,
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "nReturned" : 1,
                                "executionTimeMillisEstimate" : 0,
                                "works" : 2,
                                "advanced" : 1,
                                "needTime" : 0,
                                "needYield" : 0,
                                "saveState" : 0,
                                "restoreState" : 0,
                                "isEOF" : 1,
                                "keyPattern" : {
                                        "username" : 1
                                },
                                "indexName" : "username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "username" : [
                                                "[\"user997679\", \"user997679\"]"
                                        ]
                                },
                                "keysExamined" : 1,
                                "seeks" : 1,
                                "dupsTested" : 0,
                                "dupsDropped" : 0
                        }
                }
        },
        "serverInfo" : {
                "host" : "localhost.localdomain",
                "port" : 27017,
                "version" : "4.4.0",
                "gitVersion" : "563487e100c4215e2dce98d0af2a6a5a2d67c5cf"
        },
        "ok" : 1
}
wang> 

注意:如果索引包含数组的字段,则该索引永远不能覆盖查询(由于数组的方式存储在索引中,这在“索引对象和数组”中有更深入的介绍,即使从返回的字段中排除数组字段,依然不能使用索引。

2.$操作符如何使用索引 

(1).低效率的操作符

通常来说取反的效率比较低, $ne 查询可以使用索引,但是要扫描所有的索引,很低效

wang> db.users.find({age:{"$ne":21}}).explain("executionStats")
{
        "queryPlanner" : {
                "plannerVersion" : 1,
                "namespace" : "wang.users",
                "indexFilterSet" : false,
                "parsedQuery" : {
                        "age" : {
                                "$not" : {
                                        "$eq" : 21
                                }
                        }
                },
                "winningPlan" : {
                        "stage" : "FETCH",
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "keyPattern" : {
                                        "age" : 1,
                                        "username" : 1
                                },
                                "indexName" : "age_1_username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "age" : [ ],
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "age" : [
                                                "[MinKey, 21.0)",
                                                "(21.0, MaxKey]"
                                        ],
                                        "username" : [
                                                "[MinKey, MaxKey]"
                                        ]
                                }
                        }
                },
                "rejectedPlans" : [ ]
        },
        "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 991664,
                "executionTimeMillis" : 3833,
                "totalKeysExamined" : 991665,
                "totalDocsExamined" : 991664,
                "executionStages" : {
                        "stage" : "FETCH",
                        "nReturned" : 991664,
                        "executionTimeMillisEstimate" : 971,
                        "works" : 991666,
                        "advanced" : 991664,
                        "needTime" : 1,
                        "needYield" : 0,
                        "saveState" : 991,
                        "restoreState" : 991,
                        "isEOF" : 1,
                        "docsExamined" : 991664,
                        "alreadyHasObj" : 0,
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "nReturned" : 991664,
                                "executionTimeMillisEstimate" : 397,
                                "works" : 991666,
                                "advanced" : 991664,
                                "needTime" : 1,
                                "needYield" : 0,
                                "saveState" : 991,
                                "restoreState" : 991,
                                "isEOF" : 1,
                                "keyPattern" : {
                                        "age" : 1,
                                        "username" : 1
                                },
                                "indexName" : "age_1_username_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "age" : [ ],
                                        "username" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "age" : [
                                                "[MinKey, 21.0)",
                                                "(21.0, MaxKey]"
                                        ],
                                        "username" : [
                                                "[MinKey, MaxKey]"
                                        ]
                                },
                                "keysExamined" : 991665,
                                "seeks" : 2,
                                "dupsTested" : 0,
                                "dupsDropped" : 0
                        }
                }
        },
        "serverInfo" : {
                "host" : "localhost.localdomain",
                "port" : 27017,
                "version" : "4.4.0",
                "gitVersion" : "563487e100c4215e2dce98d0af2a6a5a2d67c5cf"
        },
        "ok" : 1
}
wang> 

这个索引查找了所有小于21和大于21的索引条目,如果索引中的值为21的条目非常多,用这个查询的效率是非常不错的,否则的话,这个查询就不得不检查几乎所有的索引条目。

$not 有时候能使用索引,但是通常它并不知道要如何使用索引,它能够对基本的范围

比如将

{"key" : {"$lt" : 7}}

变成

{"key" : {"$gte" : 7}}
db.users.find({age:{"$not":{"$lt":21}}}).explain("executionStats")

然而,大多数使用 $not 的查询会退化为全表扫描, $nin 就总是进行全表扫描

如果必须要使用这种类型的查询,可以尝试将其过滤为一个很小的结果集,然后再使用此种方式

(2).范围查询

当索引字段为 {"age" : 1, "username" : 1} 时,使用以下查询就是高效的

db.users.find({"age" : 47,"username" : {"$gt" : "user5", "$lt" : "user8"}}).explain("executionStats")

当索引字段为 {"username" : 1,"age" : 1} 时,使用以下查询就是低效的

db.users.find({"username" : {"$gt" : "user5", "$lt" : "user8"},"age" : 47}).explain("executionStats")
(3).or查询

到目前为止,mongodb在一次查询中只能使用一个索引,如果在 {"x" : 1} 上有一个索引,在 {"y" : 1} 上也有一个索引。使用 {"x" : 123, "y" : 456} 条件进行查询时,mongodb会使用其中的一个索引,而不是2个一起使用,例子如下:

准备测试数据

db.inventory.insert({ "_id" : 1, "item" : "f1", type: "food", quantity: 500 })
db.inventory.insert({ "_id" : 2, "item" : "f2", type: "food", quantity: 100 })
db.inventory.insert({ "_id" : 3, "item" : "p1", type: "paper", quantity: 200 })
db.inventory.insert({ "_id" : 4, "item" : "p2", type: "paper", quantity: 150 })
db.inventory.insert({ "_id" : 5, "item" : "f3", type: "food", quantity: 300 })
db.inventory.insert({ "_id" : 6, "item" : "t1", type: "toys", quantity: 500 })
db.inventory.insert({ "_id" : 7, "item" : "a1", type: "apparel", quantity: 250 })
db.inventory.insert({ "_id" : 8, "item" : "a2", type: "apparel", quantity: 400 })
db.inventory.insert({ "_id" : 9, "item" : "t2", type: "toys", quantity: 50 })
db.inventory.insert({ "_id" : 10, "item" : "f4", type: "food", quantity: 75 })

创建索引

db.inventory.createIndex( { quantity: 1 } )
db.inventory.createIndex( { type: 1 } )

查询语句如下(此例子中只使用了quantity字段的索引):

db.inventory.find({quantity: 50,type: "toys"}).explain("executionStats")
        "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 1,
                "executionTimeMillis" : 0,
                "totalKeysExamined" : 1,
                "totalDocsExamined" : 1,
                "executionStages" : {
                        "stage" : "FETCH",
                        "filter" : {
                                "type" : {
                                        "$eq" : "toys"
                                }
                        },
                        "nReturned" : 1,
                        "executionTimeMillisEstimate" : 0,
                        "works" : 3,
                        "advanced" : 1,
                        "needTime" : 0,
                        "needYield" : 0,
                        "saveState" : 0,
                        "restoreState" : 0,
                        "isEOF" : 1,
                        "docsExamined" : 1,
                        "alreadyHasObj" : 0,
                        "inputStage" : {
                                "stage" : "IXSCAN",
                                "nReturned" : 1,
                                "executionTimeMillisEstimate" : 0,
                                "works" : 2,
                                "advanced" : 1,
                                "needTime" : 0,
                                "needYield" : 0,
                                "saveState" : 0,
                                "restoreState" : 0,
                                "isEOF" : 1,
                                "keyPattern" : {
                                        "quantity" : 1
                                },
                                "indexName" : "quantity_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                        "quantity" : [ ]
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 2,
                                "direction" : "forward",
                                "indexBounds" : {
                                        "quantity" : [
                                                "[50.0, 50.0]"
                                        ]
                                },
                                "keysExamined" : 1,
                                "seeks" : 1,
                                "dupsTested" : 0,
                                "dupsDropped" : 0
                        }
                }
        },
 $or 是个例外, $or 可以对每个子句都使用索引,因为 $or 实际上是执行两次查询然后将结果集合并,例子如下
db.inventory.find( { $or: [ { quantity: { $lt: 80 } }, { type: "toys" } ] } ).explain("executionStats")
 "executionStats" : {
                "executionSuccess" : true,
                "nReturned" : 3,
                "executionTimeMillis" : 0,
                "totalKeysExamined" : 4,
                "totalDocsExamined" : 3,
                "executionStages" : {
                        "stage" : "SUBPLAN",
                        "nReturned" : 3,
                        "executionTimeMillisEstimate" : 0,
                        "works" : 6,
                        "advanced" : 3,
                        "needTime" : 2,
                        "needYield" : 0,
                        "saveState" : 0,
                        "restoreState" : 0,
                        "isEOF" : 1,
                        "inputStage" : {
                                "stage" : "FETCH",
                                "nReturned" : 3,
                                "executionTimeMillisEstimate" : 0,
                                "works" : 6,
                                "advanced" : 3,
                                "needTime" : 2,
                                "needYield" : 0,
                                "saveState" : 0,
                                "restoreState" : 0,
                                "isEOF" : 1,
                                "docsExamined" : 3,
                                "alreadyHasObj" : 0,
                                "inputStage" : {
                                        "stage" : "OR",
                                        "nReturned" : 3,
                                        "executionTimeMillisEstimate" : 0,
                                        "works" : 6,
                                        "advanced" : 3,
                                        "needTime" : 2,
                                        "needYield" : 0,
                                        "saveState" : 0,
                                        "restoreState" : 0,
                                        "isEOF" : 1,
                                        "dupsTested" : 4,
                                        "dupsDropped" : 1,
                                        "inputStages" : [
                                                {
                                                        "stage" : "IXSCAN",
                                                        "nReturned" : 2,
                                                        "executionTimeMillisEstimate" : 0,
                                                        "works" : 3,
                                                        "advanced" : 2,
                                                        "needTime" : 0,
                                                        "needYield" : 0,
                                                        "saveState" : 0,
                                                        "restoreState" : 0,
                                                        "isEOF" : 1,
                                                        "keyPattern" : {
                                                                "quantity" : 1
                                                        },
                                                        "indexName" : "quantity_1",
                                                        "isMultiKey" : false,
                                                        "multiKeyPaths" : {
                                                                "quantity" : [ ]
                                                        },
                                                        "isUnique" : false,
                                                        "isSparse" : false,
                                                        "isPartial" : false,
                                                        "indexVersion" : 2,
                                                        "direction" : "forward",
                                                        "indexBounds" : {
                                                                "quantity" : [
                                                                        "[-inf.0, 80.0)"
                                                                ]
                                                        },
                                                        "keysExamined" : 2,
                                                        "seeks" : 1,
                                                        "dupsTested" : 0,
                                                        "dupsDropped" : 0
                                                },
                                                {
                                                        "stage" : "IXSCAN",
                                                        "nReturned" : 2,
                                                        "executionTimeMillisEstimate" : 0,
                                                        "works" : 3,
                                                        "advanced" : 2,
                                                        "needTime" : 0,
                                                        "needYield" : 0,
                                                        "saveState" : 0,
                                                        "restoreState" : 0,
                                                        "isEOF" : 1,
                                                        "keyPattern" : {
                                                                "type" : 1
                                                        },
                                                        "indexName" : "type_1",
                                                        "isMultiKey" : false,
                                                        "multiKeyPaths" : {
                                                                "type" : [ ]
                                                        },
                                                        "isUnique" : false,
                                                        "isSparse" : false,
                                                        "isPartial" : false,
                                                        "indexVersion" : 2,
                                                        "direction" : "forward",
                                                        "indexBounds" : {
                                                                "type" : [
                                                                        "[\"toys\", \"toys\"]"
                                                                ]
                                                        },
                                                        "keysExamined" : 2,
                                                        "seeks" : 1,
                                                        "dupsTested" : 0,
                                                        "dupsDropped" : 0
                                                }
                                        ]
                                }
                        }
                }
        }

通常来说,执行2次查询z再将结果合并的效率不如单次查询高,因此尽可能的使用 $in 而不是 $or ,如果不得不使用 $or ,mongodb需要每次检查结果集并从中移除重复的文档。

使用 $in 查询时无法控制返回文档的顺序(除非进行排序)。

标签:username,index,false,age,monodb4.4,索引,quantity,stage
From: https://blog.51cto.com/u_13753753/6170229

相关文章

  • 存储IndexedDB之Dexie
    [前端大容量存储IndexedDB之Dexie.js-掘金](https://juejin.cn/post/7025592963002531871) IndexedDB存储Dexie.js 对IndexedDB的封装,语法简单,可以快速方便的编写代码 webSQL总结webSQL标准不再更新,关系型数据库,底层sqlitechrome中容量5M,支持同域名不同页面共享......
  • eyoucms 去掉 index.php后缀
    针对不同服务器、虚拟空间,运行PHP的环境也有所不同,目前主要分为:Nginx、apache、IIS以及其他服务器。下面分享如何去掉URL上的index.php字符,记得在管理后台清除缓存,对于一些ECS服务器可能要重启nginx等服务!【Nginx服务器】在原有的nginx重写文件里新增以下代码片段:location/......
  • VLOOKUP 、 INDEX 、MATCH
    VLOOKUP:VLOOKUP函数是Excel中的一个纵向查找函数,它与LOOKUP函数和HLOOKUP函数属于一类函数,在工作中都有广泛应用,例如可以用来核对数据,多个表格之间快速导入数据等函数功能。功能是按列查找,最终返回该列所需查询序列所对应的值;与之对应的HLOOKUP是按行查找的。 Vlookup最容易......
  • mysql Error:index column size too large. the maximum column size is 767 bytes
    问题现象mysql在执行脚本create创建表时,提示以下错误:indexcolumnsizetoolarge.themaximumcolumnsizeis767bytes异常原因INNODB引擎,UTF-8,主键字符串默认最大767,需要修改解决方案对数据库进行设置setglobalinnodb_large_prefix=ON参考博客......
  • mysql加解密,substring substring_index函数
    mysql加解密,substringsubstring_index函数SELECTto_base64(AES_ENCRYPT('测试串','key12345678'));SELECTAES_DECRYPT(from_base64('iqJIDwYLlcAZ/AP3VvODJg=='),'ke......
  • 在python的setup.py中如何指定多个extra-index-url?
    [本文出自天外归云的博客园]以下内容来自chatGPT的回答(正解,已验证)问题:在pythonsetup.py中如何指定多个extra-index-url?在`setup.py`文件中,我们可以使用`setuptools`......
  • Magento : Make 'Continue Shopping' button redirect to the product index page
    Magento:Make'ContinueShopping'buttonredirecttothelast-added-to-cartproduct'scategory Editcart.phtmlandreplacefollowingcode<?php......
  • How to use --extra-index-url in requirements.txt in python?
    [本文出自天外归云的博客园]以下内容来自chatGPT的回答(正解,已验证)问题1:howtouse--extra-index-urlinrequirements.txtinpython?Touse`--extra-index-url`in`......
  • python基础:split、join、replace、remove、del、pop、index小记python 字符串的split(
    这里总结了平时写脚本时经常用到的一些基础方法,做个记录1、split()函数可以基于分隔符将字符串分割成由若干子串组成的列表str.split(str="",num=string.count(str))str......
  • Caused by: java.sql.SQLException: Parameter index out of range (2 > number of pa
    一、问题背景在xml配置中自定义了sql语句二、报错截图如下三、我的项目配置如下四、分析问题五、问题原因在xml中自定义sql语句时,里面不能有注释过得sql六、解决......