Data Definition Guide © 2020 Embarcadero Technologies, Inc

Total Page:16

File Type:pdf, Size:1020Kb

Data Definition Guide © 2020 Embarcadero Technologies, Inc Product Documentation InterBase 2020 Update 1 Data Definition Guide © 2020 Embarcadero Technologies, Inc. Embarcadero, the Embarcadero Technologies logos, and all other Embarcadero Technologies product or service names are trademarks or registered trademarks of Embar- cadero Technologies, Inc. All other trademarks are property of their respective owners. Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application developers. Embarcadero enables developers to design systems right, build them faster and run them better, regard- less of their platform or programming language. Ninety of the Fortune 100 and an active community of more than three million users worldwide rely on Embarcadero products to increase productivity, reduce costs and accelerate innovation. The company's flagship tools include: Embarcadero® RAD Studio™, Del- phi®, C++Builder®, JBuilder®, and the IoT Award winning InterBase®. Founded in 1993, Embarcadero is headquartered in Austin, with offices located around the world. Embarcadero is online at www.embar- cadero.com. May, 2020 Table of Contents 2.4. Creating Read-only Databases ............. 23 TABLE OF CONTENTS 3. Altering a Database ................................... 23 4. Dropping a Database ................................ 24 5. Creating a Database Shadow ................... 25 DATA DEFINITION GUIDE .............................. 1 5.1. Advantages of Creating a Database Shadow ......................................................... 25 USING THE DATA DEFINITION GUIDE ......... 2 5.2. Limitations of Creating a Database Shadow ......................................................... 25 1. What is Data Definition? ............................. 2 5.3. Before Creating a Shadow ................... 25 2. Who Should Use the Data Definition 5.4. Using CREATE SHADOW ...................... 26 Guide .................................................................. 3 6. Dropping a Shadow .................................. 29 3. Using isql ...................................................... 3 7. Expanding the Size of a Shadow .............. 29 4. Using a Data Definition File ........................ 3 8. Using isql to Extract Data Definitions ...... 30 DESIGNING DATABASES ................................ 4 WORKING WITH TABLESPACES .................. 31 1. Overview of Design Issues .......................... 4 1. Usage ........................................................... 31 1.1. Database Versus Data Model .................. 4 2. ISQL Support .............................................. 33 1.2. Design Goals ............................................ 5 3. Requirements and Constraints ................. 33 2. Design Framework ....................................... 5 4. Backup, Restore and Recovery ................. 34 3. Analyzing Requirements ............................. 6 4.1. User interface/Usability ......................... 34 4. Collecting and Analyzing Data ................... 6 4.2. Services API ........................................... 37 5. Identifying Entities and Attributes ............. 6 6. Designing Tables .......................................... 8 SPECIFYING DATA TYPES ............................ 38 7. Determining Unique Attributes .................. 9 8. Developing a Set of Rules .......................... 9 1. About InterBase Data Types ..................... 38 8.1. Specifying a Data Type ............................ 9 2. Where to Specify Data Types ................... 40 8.2. Choosing International Character 3. Defining Numeric Data Types .................. 41 Sets ................................................................ 10 3.1. Integer Data Types ................................. 41 8.3. Specifying Domains ............................... 10 3.2. Fixed-decimal Data Types ..................... 41 8.4. Setting Default Values and NULL Sta- 3.3. Floating-point Data Types .................... 46 tus .................................................................. 10 4. Date and Time Data Types ....................... 47 8.5. Defining Integrity Constraints ................ 11 4.1. Converting to the DATE, TIME, and 8.6. Defining CHECK Constraints .................. 11 TIMESTAMP Data Types .............................. 47 9. Establishing Relationships between Ob- 4.2. How InterBase Stores Date Values ....... 48 jects .................................................................. 11 5. Character Data Types ................................ 48 9.1. Enforcing Referential Integrity ............... 12 5.1. Specifying a Character Set .................... 49 9.2. Normalizing the Database .................... 13 5.2. Fixed-length Character Data ................ 50 9.3. Choosing Indexes .................................. 16 5.3. Variable-length Character Data ............ 51 9.4. Increasing Cache Size ........................... 16 6. The BOOLEAN Data Type ......................... 52 9.5. Creating a Multifile, Distributed 7. Defining BLOB Data Types ........................ 53 Database ....................................................... 17 7.1. BLOB Columns ....................................... 53 10. Planning Security ..................................... 17 7.2. BLOB Segment Length ......................... 54 11. Naming Objects ....................................... 17 7.3. BLOB Subtypes ...................................... 55 7.4. BLOB Filters ........................................... 55 CREATING DATABASES ............................... 18 7.5. Using BLOBs with VARCHAR Data ....... 56 8. Defining Arrays .......................................... 57 1. What You Should Know ............................ 18 8.1. Multi-dimensional Arrays ...................... 58 2. Creating a Database .................................. 18 8.2. Specifying Subscript Ranges for Array 2.1. Database File Naming Conventions ...... 18 Dimensions ................................................... 58 2.2. Creating a Database Using a Data Defi- 9. Converting Data Types .............................. 59 nition File ....................................................... 19 9.1. Implicit Type Conversions ..................... 59 2.3. Using CREATE DATABASE ..................... 19 9.2. Explicit Type Conversions ..................... 60 iii Table of Contents 2. Advantages of Views ............................... 100 WORKING WITH DOMAINS ........................ 62 3. Creating Views ......................................... 100 3.1. Specifying View Column Names .......... 101 1. Creating Domains ...................................... 62 3.2. Using the SELECT Statement ............... 101 1.1. Specifying the Domain Data Type ......... 62 3.3. Using Expressions to Define 1.2. Specifying Domain Defaults .................. 63 Columns ....................................................... 101 1.3. Specifying NOT NULL ............................ 64 3.4. Types of Views: Read-only and Up- 1.4. Specifying Domain CHECK Con- date-able ..................................................... 102 straints ........................................................... 64 3.5. Inserting Data through a View ............ 103 1.5. Using the VALUE Keyword .................... 65 4. Dropping Views ....................................... 104 1.6. Specifying Domain Collation Order ...... 66 2. Altering Domains ....................................... 66 WORKING WITH CHANGE VIEWS ............ 105 3. Dropping a Domain ................................... 67 1. Getting Started with Change Views ....... 105 WORKING WITH TABLES ............................. 68 2. Creating Subscriptions to Change Views .............................................................. 106 1. Before Creating a Table ............................ 68 2.1. DROP SUBSCRIPTION .......................... 107 2. Creating Tables .......................................... 68 2.2. Grant Subscribe ................................... 108 2.1. Defining Columns .................................. 68 2.3. Set Subscription ................................... 108 2.2. Defining Integrity Constraints on a Ta- 3. Statement Execution ............................... 109 ble ................................................................. 73 4. Change Views API Support ..................... 109 2.3. Defining a CHECK Constraint ............... 77 5. Change Views SQL Language Sup- 2.4. Using the EXTERNAL FILE Option ........ 79 port ................................................................. 110 3. Altering Tables ........................................... 82 3.1. Before using ALTER TABLE ................... 83 WORKING WITH STORED PROCE- 3.2. Using ALTER TABLE .............................. 84 DURES .......................................................... 113 4. Dropping Tables ........................................ 89 4.1. Dropping a Table .................................. 89 1. Overview of Stored Procedures ............. 113 4.2. DROP TABLE Syntax ............................. 89 2. Working with Procedures ....................... 113 5. Global Temporary Tables .......................... 89 2.1. Working with Procedures Using a Data 5.1. Creating a Global Temporary Table ..... 90 Definition File ............................................... 114 5.2. Altering a Global Temporary Table ...... 90 2.2. Calling Stored Procedures ................... 114 5.3. Requirements and Constraints .............. 91 2.3. Privileges for Stored Procedures ......... 115 3. Creating Procedures ................................ 115 WORKING WITH INDEXES ..........................
Recommended publications
  • A Genetic Algorithm for Database Index Selection
    GADIS: A Genetic Algorithm for Database Index Selection Priscilla Neuhaus, Julia Couto, Jonatas Wehrmann, Duncan D. Ruiz and Felipe Meneguzzi School of Technology, PUCRS - Pontifícia Universidade Católica do Rio Grande do Sul - Porto Alegre, Brazil Email: [priscilla.neuhaus, julia.couto, jonatas.wehrmann]@edu.pucrs.br, [duncan.ruiz, felipe.meneguzzi]@pucrs.br Abstract—Creating an optimal amount of indexes, taking optimize the query response time by search for faster index into account query performance and database size remains a configurations when compared to the initial one. challenge. In theory, one can speed up query response by creating We perform a set of experiments using TPC-H, a well indexes on the most used columns, although causing slower data insertion and deletion, and requiring a much larger amount of known database benchmark [11], and we compare our results memory for storing the indexing data, but in practice, it is very with three baseline approaches: (i) the initial index configura- important to balance such a trade-off. This is not a trivial task tion; and (ii) indexes derived from a random-search algorithm. that often requires action from the Database Administrator. We Results show that GADIS outperforms the baselines, allowing address this problem by introducing GADIS, A Genetic Algorithm for better index configuration on the optimized database. for Database Index Selection, designed to automatically select the best configuration of indexes adaptable for any database Finally, we observe that our approach is much more prone schema. This method aims to find the fittest individuals for to find a proper solution that the competitive methods.
    [Show full text]
  • Response Time Analysis on Indexing in Relational Databases and Their Impact
    Response time analysis on indexing in relational databases and their impact Sam Pettersson & Martin Borg 18, June, 2020 Dept. Computer Science & Engineering Blekinge Institute of Technology SE–371 79 Karlskrona, Sweden This thesis is submitted to the Faculty of Computing at Blekinge Institute of Technology in partial fulfillment of the requirements for the bachelor’s degree in software engineering. The thesis is equivalent to 10 weeks of full-time studies. Contact Information: Authors: Martin Borg E-mail: [email protected] Sam Pettersson E-mail: [email protected] University advisor: Associate Professor. Mikael Svahnberg Dept. Computer Science & Engineering Faculty of Computing Internet : www.bth.se Blekinge Institute of Technology Phone : +46 455 38 50 00 SE–371 79 Karlskrona, Sweden Fax : +46 455 38 50 57 Abstract This is a bachelor thesis concerning the response time and CPU effects of indexing in relational databases. Analyzing two popular databases, PostgreSQL and MariaDB with a real-world database structure us- ing randomized entries. The experiment was conducted with Docker and its command-line interface without cached values to ensure fair outcomes. The procedure was done throughout seven different create, read, update and delete queries with multiple volumes of database en- tries to discover their strengths and weaknesses when utilizing indexes. The results indicate that indexing has an overall enhancing effect on almost all of the queries. It is found that join, update and delete op- erations benefits the most from non-clustered indexing. PostgreSQL gains the most from indexes while MariaDB has less of an improvement in the response time reduction.
    [Show full text]
  • Relational Database Index Design
    RReellaattiioonnaall DDaattaabbaassee IInnddeexx DDeessiiggnn Prerequisite for Index Design Workshop Tapio Lahdenmaki April 2004 Copyright Tapio Lahdenmaki, DBTech Pro 1 Relational Database Index Design CHAPTER 1: INTRODUCTION........................................................................................................................4 INADEQUATE INDEXING .......................................................................................................................................4 THE IMPACT OF HARDWARE EVOLUTION ............................................................................................................5 Volatile Columns Should Not Be Indexed – True Or False? ..........................................................................7 Example ..........................................................................................................................................................7 Disk Drive Utilisation.....................................................................................................................................8 SYSTEMATIC INDEX DESIGN ................................................................................................................................9 CHAPTER 2........................................................................................................................................................13 TABLE AND INDEX ORGANIZATION ........................................................................................................13 INTRODUCTION
    [Show full text]
  • IBM DB2 for I Indexing Methods and Strategies Learn How to Use DB2 Indexes to Boost Performance
    IBM DB2 for i indexing methods and strategies Learn how to use DB2 indexes to boost performance Michael Cain Kent Milligan DB2 for i Center of Excellence IBM Systems and Technology Group Lab Services and Training July 2011 © Copyright IBM Corporation, 2011 Table of contents Abstract........................................................................................................................................1 Introduction .................................................................................................................................1 The basics....................................................................................................................................3 Database index introduction .................................................................................................................... 3 DB2 for i indexing technology .................................................................................................................. 4 Radix indexes.................................................................................................................... 4 Encoded vector indexes .................................................................................................... 6 Bitmap indexes - the limitations ....................................................................................................... 6 EVI structure details......................................................................................................................... 7 EVI runtime usage...........................................................................................................................
    [Show full text]
  • Sql Server to Aurora Postgresql Migration Playbook
    Microsoft SQL Server To Amazon Aurora with Post- greSQL Compatibility Migration Playbook 1.0 Preliminary September 2018 © 2018 Amazon Web Services, Inc. or its affiliates. All rights reserved. Notices This document is provided for informational purposes only. It represents AWS’s current product offer- ings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS’s products or services, each of which is provided “as is” without war- ranty of any kind, whether express or implied. This document does not create any warranties, rep- resentations, contractual commitments, conditions or assurances from AWS, its affiliates, suppliers or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agree- ments, and this document is not part of, nor does it modify, any agreement between AWS and its cus- tomers. - 2 - Table of Contents Introduction 9 Tables of Feature Compatibility 12 AWS Schema and Data Migration Tools 20 AWS Schema Conversion Tool (SCT) 21 Overview 21 Migrating a Database 21 SCT Action Code Index 31 Creating Tables 32 Data Types 32 Collations 33 PIVOT and UNPIVOT 33 TOP and FETCH 34 Cursors 34 Flow Control 35 Transaction Isolation 35 Stored Procedures 36 Triggers 36 MERGE 37 Query hints and plan guides 37 Full Text Search 38 Indexes 38 Partitioning 39 Backup 40 SQL Server Mail 40 SQL Server Agent 41 Service Broker 41 XML 42 Constraints
    [Show full text]
  • Sql Server Index Fragmentation Report
    Sql Server Index Fragmentation Report Reflexive Clayborne miaows, his vibrometer tuck swelled silverly. Improbable Lionello always winches his ironist if Wain is executive or excite incompetently. Cornelius remains noble after Timothy ionizing perceptually or priggings any writes. Fragmentation in DM SQL Diagnostic Manager for SQL Server. Regular indexes rebuild at SQL-Server 200 and higher necessary Posted on Apr 01 2011. This will rejoice you owe determine the upcoming impact should any changes made. You use need to retype it select another editor or in SSMS. Is there something I need to invoke to cause it to be available? Dmf to sql server and reformat them to check index automatically by fragmented, and reorganize operations are. Index operation is not resumable. Httpblogsqlauthoritycom20100112sql-server-fragmentation-detect-fragmentation-and-eli minate-. How to Proactively Gather SQL Server Indexes Fragmentation. Indexes play a vital role in the performance of SQL Server applications Indexes are created on columns in tables or views and objective a quick. DO NOT do this during office hours. Please contact your sql servers that fragmented indexes and reports tab, indexing data published on thresholds to continue browsing experience in one person? Thanks for the code. And server reporting any fragmented indexes optimization was creating storage and easy to report taking into block right on this index for servers are reclaimed on modern frozen meals at that? Just a restore from backup, schools, monitoring and high availability and disaster recovery technologies. Dmdbindexphysicalstats to report fragmentation of bird and indexes for a specified table mountain view Many companies use maintenance plans to work regular.
    [Show full text]
  • Database Performance on AIX in DB2 UDB and Oracle Environments
    Database Performance on AIX in DB2 UDB and Oracle Environments Nigel Griffiths, James Chandler, João Marcos Costa de Souza, Gerhard Müller, Diana Gfroerer International Technical Support Organization www.redbooks.ibm.com SG24-5511-00 SG24-5511-00 International Technical Support Organization Database Performance on AIX in DB2 UDB and Oracle Environments December 1999 Take Note! Before using this information and the product it supports, be sure to read the general information in Appendix E, “Special notices” on page 411. First Edition (December 1999) This edition applies to Version 6.1 of DB2 Universal Database - Enterprise Edition, referred to as DB2 UDB; Version 7 of Oracle Enterprise Edition and Release 8.1.5 of Oracle8i Enterprise Edition, referred to as Oracle; for use with AIX Version 4.3.3. Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. JN9B Building 003 Internal Zip 2834 11400 Burnet Road Austin, Texas 78758-3493 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright International Business Machines Corporation 1999. All rights reserved. Note to U.S Government Users – Documentation related to restricted rights – Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Contents Preface...................................................xv How this book is organized .......................................xv The team that wrote this redbook. ..................................xvi Commentswelcome.............................................xix Chapter 1. Introduction to this redbook .........................1 Part 1. RDBMS concepts .................................................3 Chapter 2. Introduction into relational database system concepts....5 2.1WhatisanRDBMS?.......................................5 2.2 What does an RDBMS provide? .
    [Show full text]
  • Declare in Select Statement Sql
    Declare In Select Statement Sql hyperbatically.Israelitish Rube Saturate intergrades and well-nigh.proxy Whit Armour-plated often infibulate Bentley some alwayssuperchargers nickelize unprofessionally his pinnacles if orSaunders tranquilize is sceptical judicially. or nickeled Dynamic SQL statements can be built interactively with flame from users having network or no plague of SQL. We know loop over Rows with foreach, the SET statement will override the road value worth the variable and diminish the NULL value. Run your apps wherever you live them. The SET statement errors out if your query returns more limit one result set as shown below. It makes life easier if the lists in sediment input strings start my end just a comma. Thank you for fashion feedback! MEAN, analytics, and myself first. Foreach Loop container to merit each work the tables in Tables. Postnummer är en bra geografisk indelning för att visualisera kunddata, however, can manage APIs with a fully managed gateway. Repeats a statement or dam of statements while has given. SQL, the compact clause is placed between the INSERT and VALUES clause. Enterprise are for employees to somewhere find company information. On the right where my Excel Worksheet and the Message Box jump the country output going my VBA Macro. Platform for BI, it is machine to beloved that parameters are added to the collection in the american they appear benevolent the SQL, they will emit because of the brightest gravitational waves in entire universe. HAVING clause with any valid SQL expression one is evaluated as inferior true or false label each beat in source query.
    [Show full text]
  • A Fast, Yet Lightweight, Indexing Scheme for Modern Database Systems
    Two Birds, One Stone: A Fast, yet Lightweight, Indexing Scheme for Modern Database Systems 1Jia Yu 2Mohamed Sarwat School of Computing, Informatics, and Decision Systems Engineering Arizona State University, 699 S. Mill Avenue, Tempe, AZ [email protected], [email protected] ABSTRACT Table 1: Index overhead and storage dollar cost Classic database indexes (e.g., B+-Tree), though speed up + queries, suffer from two main drawbacks: (1) An index usu- (a) B -Tree overhead ally yields 5% to 15% additional storage overhead which re- TPC-H Index size Initialization time Insertion time sults in non-ignorable dollar cost in big data scenarios espe- 2GB 0.25 GB 30 sec 10 sec cially when deployed on modern storage devices. (2) Main- 20 GB 2.51 GB 500 sec 1180 sec taining an index incurs high latency because the DBMS has 200 GB 25 GB 8000 sec 42000 sec to locate and update those index pages affected by the un- derlying table changes. This paper proposes Hippo a fast, (b) Storage dollar cost yet scalable, database indexing approach. It significantly HDD EnterpriseHDD SSD EnterpriseSSD shrinks the index storage and mitigates maintenance over- 0.04 $/GB 0.1 $/GB 0.5 $/GB 1.4 $/GB head without compromising much on the query execution performance. Hippo stores disk page ranges instead of tuple pointers in the indexed table to reduce the storage space oc- table. Even though classic database indexes improve the cupied by the index. It maintains simplified histograms that query response time, they face the following challenges: represent the data distribution and adopts a page group- ing technique that groups contiguous pages into page ranges • Indexing Overhead: Adatabaseindexusually based on the similarity of their index key attribute distri- yields 5% to 15% additional storage overhead.
    [Show full text]
  • A Database Optimization Strategy for Massive Data Based Information System
    Advances in Computer Science Research, volume 93 2nd International Conference on Mathematics, Modeling and Simulation Technologies and Applications (MMSTA 2019) A Database Optimization Strategy for Massive Data Based Information System Qianglai Xie*, Wei Yang and Leiyue Yao Jiangxi University of Technology, China *Corresponding author Abstract—With the rapid arrival of the information support technology for the physical design of the entire explosion era, the amount of data stored in a single table of an database, and the method of range partitioning is mainly used enterprise information management system is getting more and in the SQL Sever databases design [6][7]. more common. Therefore, efficiency optimization of SQL based on the massive data is an essential task to break the bottleneck in The index of the database table structure is an important current enterprise information management systems. This paper factor affecting the database performance. Establishing a proposes single table optimization methods for massive database. reasonable index on the basis of physical optimization will These methods including: physical optimization, index directly affect the efficiency of the entire database access [8,9]. optimization and query statement optimization. Each The pages of SQL server data storage include two types: data optimization method is integrated into the database design pages and index pages. By default, data exists in the data pages, process, and a set of optimization programs for the massive but as long as the index data exists, the indexes will be database design process is proposed. In the test environment, the automatically stored in the index page [10,11]. The index types size of the databases file is over 200G and single table records is include: clustered and non-clustered indexes.
    [Show full text]
  • Introduction to Database Design 1 Indexing
    Introduction to Database Design 1 Indexing RG 8.1, 8.2, 8.3, 8.5 Rasmus Pagh Introduction to Database Design 2 Disk crash course • Relations of large databases are usually stored on hard drives (or SSDs). • Hard drives can store large amounts of data, but work rather slowly compared to the memory of a modern computer: • The time to access a specific piece of data is on the order of 106 (104) times slower. • The rate at which data can be read is on the order of 100 (10) times slower. • Time for accessing disk may be the main performance bottleneck! Introduction to Database Design 3 Parallel data access • Large database systems (and modern SSDs) use several storage units to: – Enable several pieces of data to be fetched in parallel. – Increase the total rate of data from disk. • Systems of several disks are often arranged in so-called RAID systems, with various levels of error resilience. • Even in systems with this kind of parallelism, the time used for accessing data is often the performance bottleneck. Introduction to Database Design 4 Full table scans When a DBMS sees a query of the form !SELECT *! !FROM R! !WHERE <condition>! the obvious thing to do is read through the tuples of R and report those tuples that satisfy the condition. This is called a full table scan. Introduction to Database Design 5 Selective queries Consider the query from before • If we have to report 80% of the tuples in R, it makes sense to do a full table scan. • On the other hand, if the query is very selective, and returns just a small percentage of the tuples, we might hope to do better.
    [Show full text]
  • Dynamic Merkle B-Tree with Efficient Proofs
    Dynamic Merkle B-tree with Efficient Proofs Chase Smith* [email protected], [email protected] Alex Rusnak [email protected], [email protected] June 17, 2020 Abstract We propose and define a recursive Merkle structure with q-mercurial commitments, in order to create a concise B-Merkle tree. This Merkle B-Tree builds on previous work of q-ary Merkle trees which use concise, constant size, q-mercurial commitments for intranode proofs. Although these q-ary trees reduce the branching factor and height, they still have their heights based on the key length, and are forced to fixed heights. Instead of basing nodes on q-ary prefix trees, the B Merkle Tree incorporates concise intranode commitments within a self-balancing tree. The tree is based on the ordering of elements, which requires extra information to determine element placement, but it enables significantly smaller proof sizes. This allows for much lower tree heights (directed by the order of elements, not the size of the key), and therefore creates smaller and more efficient proofs and operations. Additionally, the B Merkle Tree is defined with subset queries that feature similar communication costs to non-membership proofs. Our scheme has the potential to benefit outsourced database models, like blockchain, which use authenticated data structures and database indices to ensure immutability and integrity of data. We present potential applications in key-value stores, relational databases, and, in part, Merkle forests. Keywords: Merkle, Authenticated data structure, accumulator Contents 1 Introduction 2 2 Preliminaries 2 2.1 Related work . .3 2.2 Our Contributions . .3 3 Dynamic B+ Merkle tree 3 3.1 Node structure .
    [Show full text]