文档将clientId描述为:
这匿名地标识特定用户,设备或浏览器实例. https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cid
它可用于将服务器端命中发送到分析,同时仍将它们绑定到特定用户.
在封闭测试中还有一个名为userId的功能,一旦用户通过身份验证,您就可以通过该功能:https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
userId相当不言自明.但是,如果您选择,UA还允许您通过自己的clientid.对于开发CRM类型的工具,可以将clientid与用户关联起来,就像使用userid一样吗?目标主要是能够跟踪离线互动并将其与Google Analytics中的访问者相关联.
大约每月一次,我们遇到了一个奇怪的错误,我没有解释.错误是这样的:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.List`1.Enumerator.MoveNext() at
System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
Run Code Online (Sandbox Code Playgroud)
这是发生错误的代码.在MyObject的构造函数中调用此方法:
// pull a list of MyObjects from the cache so we can see if this one exists
List<MyObject> MyObjectList= System.Web.HttpRuntime.Cache["MyObjects"] as List<MyObject>;
if (MyObjectList!= null)
{
// this is where the error happens. Just getting an object out based on its id
MyObject obj = MyObjectList.FirstOrDefault(m => m.Id == this.Id);
if(obj != null){
// great, it already exists in the cache
} …Run Code Online (Sandbox Code Playgroud) 我有一个查询,基于主键删除一组300条记录.
该表大约有250,000条记录和4列(int PK,varchar,date,tinyint),因此它应该是一个非常易于管理的大小,但是,在没有运行其他查询的情况下删除大约需要2分钟,这看起来相当多它删除的行数和表的大小.
sql看起来像这样:
-- this takes less than 1 second
CREATE TEMPORARY TABLE IF NOT EXISTS temp AS (
SELECT id
FROM some_other_table
WHERE ...
LIMIT 300
);
-- id is the primary key
-- this takes upwards of 2 minutes
DELETE FROM queue WHERE id in(
select id from temp
);
Run Code Online (Sandbox Code Playgroud)
该表只有一个附加索引,没有外键关系.有什么想法,我可以做些什么来加快这个速度?