<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Designing for K-safety</title>
    <link>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/</link>
    <description>Recent content in Designing for K-safety on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Admin: Requirements for a K-safe physical schema design</title>
      <link>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/requirements-k-safe-physical-schema-design/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/requirements-k-safe-physical-schema-design/</guid>
      <description>
        
        
        &lt;p&gt;Database Designer automatically generates designs with a K-safety of 1 for clusters that contain at least three nodes. (If your cluster has one or two nodes, it generates designs with a K-safety of 0. You can modify a design created for a three-node (or greater) cluster, and the K-safe requirements are already set.&lt;/p&gt;
&lt;p&gt;If you create custom projections, your physical schema design must meet the following requirements to be able to successfully recover the database in the event of a failure:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Segmented projections must be &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../../../en/glossary/segmentation/&#34; title=&#34;Defines how physical data storage (projections) is stored in a database cluster using the CREATE PROJECTION statement.&#34;&gt;segmented&lt;/a&gt; across all nodes. Refer to &lt;a href=&#34;../../../../../../../en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-segmentation/#&#34;&gt;Designing for segmentation&lt;/a&gt; and &lt;a href=&#34;../../../../../../../en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-segmented-projections-k-safety/#&#34;&gt;Designing segmented projections for K-safety&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replicated projections must be replicated on all nodes. See &lt;a href=&#34;../../../../../../../en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-unsegmented-projections-ksafety/#&#34;&gt;Designing unsegmented projections for K-Safety&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Segmented projections must have K+1 &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../../../en/glossary/buddy-projection/&#34; title=&#34;Required for K-safety.&#34;&gt;buddy&lt;/a&gt; projections—projections with identical columns and segmentation criteria, where corresponding segments are placed on different nodes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can use the 
&lt;code&gt;&lt;a href=&#34;../../../../../../../en/sql-reference/functions/management-functions/catalog-functions/mark-design-ksafe/#&#34;&gt;MARK_DESIGN_KSAFE&lt;/a&gt;&lt;/code&gt; function to find out whether your schema design meets requirements for K-safety.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Requirements for a physical schema design with no K-safety</title>
      <link>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/requirements-physical-schema-design-with-no-k-safety/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/requirements-physical-schema-design-with-no-k-safety/</guid>
      <description>
        
        
        &lt;p&gt;If you use Database Designer to generate an comprehensive design that you can modify and you do not want the design to be K-safe, set K-safety level to 0 (zero).&lt;/p&gt;
&lt;p&gt;If you want to start from scratch, do the following to establish minimal projection requirements for a functioning database with no K-safety (K=0):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Define at least one &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../../../en/glossary/superprojection/&#34; title=&#34;A projection that includes all columns in an anchor table.&#34;&gt;superprojection&lt;/a&gt; for each table in the &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../../../en/glossary/logical-schema/&#34; title=&#34;Consists of a set of tables and referential integrity constraints in an OpenText&amp;amp;trade; Analytics Database.&#34;&gt;logical schema&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replicate (define an exact copy of) each dimension table superprojection on each &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../../../en/glossary/statement/&#34; title=&#34;A line of SQL, excluding the semicolon.&#34;&gt;node&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Designing segmented projections for K-safety</title>
      <link>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-segmented-projections-k-safety/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-segmented-projections-k-safety/</guid>
      <description>
        
        
        &lt;p&gt;Projections must comply with database K-safety requirements. In general, you must create buddy projections for each segmented projection, where the number of buddy projections is K+1. Thus, if system K-safety is set to 1, each projection segment must be duplicated by one buddy; if K-safety is set to 2, each segment must be duplicated by two buddies.&lt;/p&gt;
&lt;h2 id=&#34;automatic-creation-of-buddy-projections&#34;&gt;Automatic creation of buddy projections&lt;/h2&gt;
&lt;p&gt;You can use 
&lt;code&gt;&lt;a href=&#34;../../../../../../../en/sql-reference/statements/create-statements/create-projection/#&#34;&gt;CREATE PROJECTION&lt;/a&gt;&lt;/code&gt; so it automatically creates the number of buddy projections required to satisfy K-safety, by including &lt;code&gt;SEGMENTED BY ... ALL NODES&lt;/code&gt;. If &lt;code&gt;CREATE PROJECTION&lt;/code&gt; specifies K-safety (&lt;code&gt;KSAFE=&lt;/code&gt;&lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt;&lt;code&gt;)&lt;/code&gt;, the database uses that setting; if the statement omits &lt;code&gt;KSAFE&lt;/code&gt;, the database uses system K-safety.&lt;/p&gt;
&lt;p&gt;In the following example, &lt;code&gt;CREATE PROJECTION&lt;/code&gt; creates segmented projection &lt;code&gt;ttt_p1&lt;/code&gt; for table &lt;code&gt;ttt&lt;/code&gt;. Because system K-safety is set to 1, the database requires a buddy projection for each segmented projection. The &lt;code&gt;CREATE PROJECTION&lt;/code&gt; statement omits &lt;code&gt;KSAFE&lt;/code&gt;, so the database uses system K-safety and creates two buddy projections: &lt;code&gt;ttt_p1_b0&lt;/code&gt; and &lt;code&gt;ttt_p1_b1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT mark_design_ksafe(1);

  mark_design_ksafe
----------------------
 Marked design 1-safe
(1 row)

=&amp;gt; CREATE TABLE ttt (a int, b int);
WARNING 6978:  Table &amp;#34;ttt&amp;#34; will include privileges from schema &amp;#34;public&amp;#34;
CREATE TABLE

=&amp;gt; CREATE PROJECTION ttt_p1 as SELECT * FROM ttt SEGMENTED BY HASH(a) ALL NODES;
CREATE PROJECTION

=&amp;gt; SELECT projection_name from projections WHERE anchor_table_name=&amp;#39;ttt&amp;#39;;
 projection_name
-----------------
 ttt_p1_b0
 ttt_p1_b1
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The database automatically names buddy projections by appending the suffix &lt;code&gt;_b&lt;/code&gt;&lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt; to the projection base name—for example &lt;code&gt;ttt_p1_b0&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;manual-creation-of-buddy-projections&#34;&gt;Manual creation of buddy projections&lt;/h2&gt;
&lt;p&gt;If you create a projection on a single node, and system K-safety is greater than 0, you must manually create the number of buddies required for K-safety. For example, you can create projection &lt;code&gt;xxx_p1&lt;/code&gt; for table &lt;code&gt;xxx&lt;/code&gt; on a single node, as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE xxx (a int, b int);
WARNING 6978:  Table &amp;#34;xxx&amp;#34; will include privileges from schema &amp;#34;public&amp;#34;
CREATE TABLE

=&amp;gt; CREATE PROJECTION xxx_p1 AS SELECT * FROM xxx SEGMENTED BY HASH(a) NODES v_vmart_node0001;
CREATE PROJECTION
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Because K-safety is set to 1, a single instance of this projection is not K-safe. Attempts to insert data into its anchor table &lt;code&gt;xxx&lt;/code&gt; return with an error like this:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; INSERT INTO xxx VALUES (1, 2);
ERROR 3586:  Insufficient projections to answer query
DETAIL:  No projections that satisfy K-safety found for table xxx
HINT:  Define buddy projections for table xxx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In order to comply with K-safety, you must create a buddy projection for projection &lt;code&gt;xxx_p1&lt;/code&gt;. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE PROJECTION xxx_p1_buddy AS SELECT * FROM xxx SEGMENTED BY HASH(a) NODES v_vmart_node0002;
CREATE PROJECTION
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Table &lt;code&gt;xxx&lt;/code&gt; now complies with K-safety and accepts DML statements such as &lt;code&gt;INSERT&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;VMart=&amp;gt; INSERT INTO xxx VALUES (1, 2);
 OUTPUT
--------
      1
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;p&gt;For general information about segmented projections and buddies, see &lt;a href=&#34;../../../../../../../en/admin/projections/segmented-projections/#&#34;&gt;Segmented projections&lt;/a&gt;. For information about designing for K-safety, see &lt;a href=&#34;../../../../../../../en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/#&#34;&gt;Designing for K-safety&lt;/a&gt; and &lt;a href=&#34;../../../../../../../en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-segmentation/#&#34;&gt;Designing for segmentation&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Designing unsegmented projections for K-Safety</title>
      <link>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-unsegmented-projections-ksafety/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/configuring-db/creating-db-design/creating-custom-designs/planning-your-design/designing-k-safety/designing-unsegmented-projections-ksafety/</guid>
      <description>
        
        
        &lt;p&gt;In many cases, dimension tables are relatively small, so you do not need to segment them. Accordingly, you should design a K-safe database so projections for its dimension tables are replicated without segmentation on all cluster nodes. You create these projections with a 
&lt;code&gt;&lt;a href=&#34;../../../../../../../en/sql-reference/statements/create-statements/create-projection/#&#34;&gt;CREATE PROJECTION&lt;/a&gt;&lt;/code&gt; statement that includes the keywords &lt;code&gt;UNSEGMENTED ALL NODES&lt;/code&gt;. These keywords specify to create identical instances of the projection on all cluster nodes.&lt;/p&gt;
&lt;p&gt;The following example shows how to create an unsegmented projection for the table &lt;code&gt;store.store_dimension&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; CREATE PROJECTION store.store_dimension_proj (storekey, name, city, state)
             AS SELECT store_key, store_name, store_city, store_state
             FROM store.store_dimension
             UNSEGMENTED ALL NODES;
CREATE PROJECTION
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Vertica uses the same name to identify all instances of the unsegmented projection—in this example, &lt;code&gt;store.store_dimension_proj&lt;/code&gt;. The keyword &lt;code&gt;ALL NODES&lt;/code&gt; specifies to replicate the projection on all nodes:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; \dj store.store_dimension_proj
                         List of projections
 Schema |         Name         |  Owner  |       Node       | Comment
--------+----------------------+---------+------------------+---------
 store  | store_dimension_proj | dbadmin | v_vmart_node0001 |
 store  | store_dimension_proj | dbadmin | v_vmart_node0002 |
 store  | store_dimension_proj | dbadmin | v_vmart_node0003 |
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For more information about projection name conventions, see &lt;a href=&#34;../../../../../../../en/admin/projections/projection-naming/#&#34;&gt;Projection naming&lt;/a&gt;.&lt;/p&gt;


      </description>
    </item>
    
  </channel>
</rss>
