Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server RavenDB导出\将数据导入SQL Server_Sql Server_Ravendb - Fatal编程技术网

Sql server RavenDB导出\将数据导入SQL Server

Sql server RavenDB导出\将数据导入SQL Server,sql-server,ravendb,Sql Server,Ravendb,简单问题:如何将数据从SQL Server导出到RavenDB 我编写了一个脚本,它从SQLServer获取数据并存储在raven中,但运行速度非常慢。大约每秒2500次插入 编辑: 我的代码 for(int i=0;inewkeyphraseinfo()){ 关键字=x.Word, Id=x.Id, 计数=x.计数, 日期=x.日期 })); GC.Collect(); } 公共静态void StoreInTaven(IEnumerable wordStats) { 使用(var sessio

简单问题:如何将数据从SQL Server导出到RavenDB

我编写了一个脚本,它从SQLServer获取数据并存储在raven中,但运行速度非常慢。大约每秒2500次插入

编辑: 我的代码

for(int i=0;inewkeyphraseinfo()){
关键字=x.Word,
Id=x.Id,
计数=x.计数,
日期=x.日期
}));
GC.Collect();
}
公共静态void StoreInTaven(IEnumerable wordStats)
{
使用(var session=store.OpenSession())
{
foreach(wordStats中的var wordStat)
{
session.Store(wordStat);
}
session.SaveChanges();
}
}

我也在做同样的事情。速度不是我真正关心的问题,所以我不知道这是否比你的更快

public static void CopyFromSqlServerToRaven(IDocumentSession db, bool ravenDeleteAll=true)
{
    if (ravenDeleteAll) db.DeleteAll();

    using (var connection = new SqlConnection(SqlConnectionString))
    {
        var command = new SqlCommand(SqlGetContentItems, connection);
        command.Connection.Open();
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                db.Store(new ContentItem
                            {
                                    Id = reader["Id"].ToString(),
                                    Title = (string)reader["Name"],
                                    Description = (string)reader["ShortDescription"],
                                    Keywords = (string)reader["SearchKeywords"]
                            });
            }
        }
        db.SaveChanges();
    }
}

我也在做同样的事情。速度不是我真正关心的问题,所以我不知道这是否比你的更快

public static void CopyFromSqlServerToRaven(IDocumentSession db, bool ravenDeleteAll=true)
{
    if (ravenDeleteAll) db.DeleteAll();

    using (var connection = new SqlConnection(SqlConnectionString))
    {
        var command = new SqlCommand(SqlGetContentItems, connection);
        command.Connection.Open();
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                db.Store(new ContentItem
                            {
                                    Id = reader["Id"].ToString(),
                                    Title = (string)reader["Name"],
                                    Description = (string)reader["ShortDescription"],
                                    Keywords = (string)reader["SearchKeywords"]
                            });
            }
        }
        db.SaveChanges();
    }
}

我相信它在标准服务器上支持每秒1000次写入

当我增加缓存大小时,性能提高了。 Raven/Esent/CacheSizeMax


我相信它支持在标准服务器上每秒写入1000次

当我增加缓存大小时,性能提高了。 Raven/Esent/CacheSizeMax


将用于插入RavenDB的代码张贴到RavenDB中。插入的速度是你的代码的一个因素,可能是它运行的机器。将你用来插入的代码发布到RavenDB。插入速度是你的代码的一个因素,可能是它运行的机器。我正在做类似你的事情,但1000亿行需要很长时间。我正在做类似你的事情,但1000亿行需要很长时间。