1. Prepare
Create a base table first:
CREATE TABLE mytb1 (ID serial,name character varying,age integer);To create an index on the name field:
Create INDEX Mytb1_name_index on MYTB1 (name);
To view the MYTB1
with SQL commands
\? For help with Psql commands
\g or terminate with semicolon to execute query
\q to quit
Zwcdb=>
Create a table[Plain]View Plaincopyprint?
[Email protected] data]$ psql-u zhongwc-d zwcdb-h 192.168.1.203-p 1521
Password for user zhongwc:
Psql (9.2.2)
Type ' help ' for help.
Zwcdb=> CREATE
Tags: handle toe test connect ant Import Export command exp GREWhat this article contains: Use commands to manipulate import and export of Oracle, Postgres, MySQL, including logging on to dataNote: I am using the Center OS operating system in the company, so both Oracle and Postgres are used in Linux and not tested in other tools, and MySQL is used on its own laptops, both under Linux and DOS commands.1.Ora
in the CREATESTMT structure, and then control whether or not to create a table or make an error message.Get the current user name as followsDatumcurrent_user (Pg_function_args) {pg_return_datum (DirectFunctionCall1 (Namein, Cstringgetdatum ( Getusernamefromid (GetUserId ()))));}This function is the intrinsic function of the PG, using the effect:postgres=# Select Current_User; Current_User--------------
foreign keys to other database tables, and other tables had foreign keys to it:# tell MySQL to ignore foreign keys in a little whileset foreign_key_checks = 0;# drop my old database Tabledrop table if exists entities;# re-create my tablecreate table entities ( ID int unsigned auto_increment NOT null primary key, project_id int unsigned not NULL, name varchar
Label: --View current Server database
SELECTDatname fromPg_database--view the created user table
SELECT * fromPg_stat_user_tables--Create a database
CREATE DATABASE"Fxsz_lt" withOWNER=Postgres ENCODING='UTF8'tablespace=Pg_default--lc_collate= ' Chinese (Simplified) _people ' s Republic of china.936 '
--lc_ctype= ' Chi
-based, even if committed, the data in the temporary table will also exist-another delete type of temporary table, in transaction units, the table will still exist after the commit, but the data inside the table will be emptied--To avoid confusion, delete the temporary table
are document.body objects in the loop, the benefits will be considerable if they are modified by reference.
Subsequently, I cached the Document object----in our test, the Document object was referenced 3,002 times. The modified code is as follows:
View the third sample.
The run time is only 2100ms, saving about 10% of the time. Using local variables instead of directly referencing the Document object saves an average of 0.4 milliseconds each time.
A common way to optimize performance is to
column properties and indexes defined in the original table: CREATE TABLE new_tbl like orig_tbl; Create a table with a primary key, a unique index, and a normal index: CREATE TABLE '
Create | skills | performance
One important part of the Microsoft development cycle is to adjust the performance of the product. Performance tuning is one of the key components that developers should be mindful of. After years of development, the industry has a lot to learn about how to optimize the performance of WIN32 programs.
One of the problems developers now encounter is that it's not clear what causes DTHML and HTML pages to run fast or slow. O
Label:First, the environment$ psql--version
psql (PostgreSQL) 9.4.4 As we all know, superuser privileges are too large for the security of the database, for non-administrator accounts, you need to create a normal user. Second, the grammar$psql psql (9.4.4) type "Help" forhelp.
postgres=#\hcreaterole Command:createrole Description:defineanewdatabaserole syntax:createrolename[ [with]option[...]] Whereoptionc
Label:1 CREATE TABLE A like BThis way, when you copy table B to a, the complete field structure and index of table B is copied to table A.2. CREATE TABLE A as SELECT * from BThis method
Copy Code code as follows:
CREATE TABLE A like B
This way, when you copy table B to a, the complete field structure and index of table B are copied into table A.
Copy Code code as follows:
CREATE
CREATE TABLE A like BThis way, when you copy table B to a, the complete field structure and index of table B is copied to table A.CREATE TABLE A as SELECT x,x,x,xx from B LIMIT 0This method only copies the field structure of
. Temporary tableConclusionIn summary, we will find that there are many differences in the underlying processing mechanism between temporary tables and table variables.To sum up, we recommend that you use table variables for small temporary computation datasets. If the dataset is large, if it is used for temporary computing in the code, and such temporary use is always a simple full dataset scan without any
Table replication in MySQL: create table like and create table as select, tables in mysql
Copy codeThe Code is as follows:CREATE TABLE A LIKE B
In this way, when table B is copied to
Comparison between MySQL create table as and create table like
In MySQL databases, there are multiple ways to clone tables. For example, you can use create table... or
in:Second, after you create a filegroup, you create several more database files. Why create a database file, this is very understandable, because the partition of the small table must be placed on the hard disk, and put on the hard disk where? Of course it's in the papers. Besides, there are no files in the filegroup,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.