小编DkD*_*Dev的帖子

MultiTenant表是否应在主键和外键中包含TenantID?

对于多租户单个共享数据库,tenantid字段是否应包含在主键和聚簇索引中?或者在tenantid上添加额外的索引,就像表现一样?

我们在生产系统上遇到性能问题,其唯一索引是主键上的聚簇索引.

所有sql select语句都在其linq到实体语句中以tenantid开头,例如

invoiceitems.tenantid = thecurrenttenantid order by invoicedate
Run Code Online (Sandbox Code Playgroud)

当前的模式

租户(tenantid uniqueidentifier主键,tenantname)外键(tenantid)索引(在tenantid上聚集)

客户(tenantid uniqueidentifier,customerid uniqueidentifier主键,customername varchar(50))外键(tenantid,customerid)索引(聚集在customerid上)

发票(tenantid uniqueidentifier,invoiceid uniqueidentifier主键,billcustomerid uniqueidentifier,shipcustomerid uniqueidentifier,invoicedate datetime)外键(tenantid,billcustomerid,shipcustomerid)索引(聚集在invoiceid上)

InvoiceItems(tenantid uniqueidentifier,invoiceitemid uniqueidentifier primarykey,invoiceid uniqueidentifier,lineitemorder int)外键(tenantid,invoiceid)索引(聚集在invoiceitemid上)

SqlAzure要求每个表都有一个聚簇索引,因此它当前只在primarykeyid上,因为这是默认值.现在,这是每个表的唯一索引.整个系统中的表中有各种外键,并且没有索引外键表字段.

我们正在尝试解决一些性能问题,并且想知道什么是最好的聚簇索引以及是否有任何其他索引可能有用.我们希望我们不必更改现有的聚集索引,除非我们必须这样做,但我们愿意这样做.在SqlAzure AFAIK中,您不能简单地调整现有表中的聚簇索引 - 您必须创建具有所需聚簇索引的新表,并将旧表中的所有记录插入到新表中(并处理所有外键约束和其他表依赖项).

所有sql select语句都以linq到entity语句中的tenantid开头.

invoiceitems.tenantid = thecurrenttenantid order by invoicedate
Run Code Online (Sandbox Code Playgroud)

一些sql select语句只有一个顺序 - 有些在引入子表时有一些其他连接条件值

invoiceitems.tenantid = thecurrenttenantid and invoice.invoiceid = invoiceitems.invoiceid order by invoicedate
Run Code Online (Sandbox Code Playgroud)

以下是一些想法(除此之外我们对其他人开放) - 哪一个最好,为什么

主要指标选项

加快访问租户的记录

选项1 - 在tenantid上添加非聚集索引 …

indexing database-design azure multi-tenant azure-sql-database

15
推荐指数
1
解决办法
1964
查看次数

构建项目时,VS 2015 Native编译器在.rdlc文件上返回值-1073741511

我收到了这个错误:

rsUnexpectedCompilerError:编译表达式时发生意外错误.本机编译器返回值:' - 10373741511'

,在现有项目的盒子rdlc上的新盒子上编译时Visual Studio 2015Windows 8.1

这发生在具有表达式的项目中的每个现有r d lc文件上.

我查了一下.我安装了最新的sql服务器数据工具(ssdt).

我还创建了一个全新的控制台应用程序,其中包含没有表达式的空报表,它编译得很好.当我向该空报表添加表达式时,如下例所示,它拒绝编译.

有谁知道我怎么能用表达式Visual Studio编译rdlcs?计算机在重新成像之前用于执行此操作windows 8.1.

这是一个无法编译的文件示例:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Textbox Name="Textbox1">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>="goo"</Value>
                <Style />
              </TextRun>
            </TextRuns>
            <Style />
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox1</rd:DefaultName>
        <Top>0.62375in</Top>
        <Left>2.88417in</Left>
        <Height>0.25in</Height>
        <Width>1in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
    </ReportItems>
    <Height>2in</Height>
    <Style />
  </Body>
  <Width>6.5in</Width>
  <Page> …
Run Code Online (Sandbox Code Playgroud)

visual-studio reporting-services sql-server-2014 sql-server-data-tools visual-studio-2015

6
推荐指数
1
解决办法
5327
查看次数