statements to reduce the cost of committing a transaction;Use cluster when extracting multiple records from an index;Use limit when extracting part of a record from a query result;Use pre-compiled queries (Prepared query);Use analyze to maintain accurate optimization statistics;Regular use of VACUUM or pg_autovacuumDelete indexes first when making large amounts
Mr. Huang took an SQL statement and asked me if I could optimize it. After reading it, the data volume is not large and the query is not complex. The record optimization process is as follows:DB: PostgreSQL 9.1OS: CentOS 6Count (d_personal_report_view )~ 9 K entries. The field type involved in the amount is numeric (9, 2 ).Original SQL:
select distinct c.doctor_n
1, Testing purpose
By running the standard test program TPC-B and TPC-C, determine the performance differences between different parameters and different versions (8.2.14 vs 8.4.2, it provides reference for parameter configuration and version selection of PostgreSQL databases on ECOP cm.
The test platform is:
Hardware configuration: CPU e4600 dual-core 2.4g 2g RAM 160g SATA * 2
Operating System: Ubuntu 9.10 Server
File System: ext3
Databases:
PostgreSQL CPU Full (100%) performance analysis and optimizationTransferred from: https://help.aliyun.com/knowledge_detail/43562.htmlIn database operations, a DBA often encounters a more urgent problem, that is, the sudden CPU full (CPU utilization reaches 100%), causing the business to stall. When the CPU is full, it is often necessary to start from the backend database, go back to the specific SQL, and finally locate the business layer. The followin
Description of PostgreSQL lock query and killing Process
Query the locks in the table.
Select a. locktype, a. database, a. pid, a. mode, a. relation, B. relname
From pg_locks
Join pg_class B on a. relation = B. oid
Where upper (B. relname) = 'table _ name ';
The preceding SQL statement is used to query whether a table
Tags: timezone ack exec null tin overflow public text romLab Environment: DB is PostgreSQL version 8.2.15 JDK1.8 Test A Query a SQL using JDBC: Public Static voidtest1 (string url, Properties props) {String SQL= "Select L.src_ip, l.location_id," + "sum (l.us_bytes) as Up_usage," + "sum (l.ds_bytes) As Down_usage, "+" (sum (l.us_bytes) + sum (l.ds_bytes)) as Total_usage "+" from unmapped _endpoint_location_
Tags: version default configuration effective etc Modify Res HTTP configuration optimizationsHttp://www.cnblogs.com/mywebnumber/p/5826795.htmlThe default configuration profile is the postgresql.conf file that is saved in the/etc/postgresql/version/main directoryIf you want to see if the parameter modification takes effect, you can use Psql to connect to the database and use the Common Fault handling:http://blog.csdn.net/kongxx/article/details/5964638P
tss_tidlist array, with the initial value set to-1. The next Ctid value is then fetched from the tss_tidlist, and then the heap_fetch supplied by the storage module is called to get the tuple from the Ctid and return. For concurrent needs, when the Tidscan node is used for "currentof". (cursor name) statement, the obtained ctid may have been modified by another transaction, need to obtain the latest version of this ctid corresponding tuple (using the hot chain), and then call Heap_fetch to get
Welcome to the Oracle community forum and interact with 2 million technical staff. One of the main features of PostgreSQL is to create custom "views". These views are only pre-defined SQL queries, they are stored in the database and can be reused as needed. Therefore, it is more effective to store frequently-used SQL queries in this way than to input them manually each time.
Welcome to the Oracle community forum and interact with 2 million technical s
Mysql uses indexes for query optimization and mysql index Query Optimization
The purpose of indexing is to improve the query efficiency. It can be analogous to a dictionary. If you want to query the word "mysql", you must locate t
Golang Custom Data Type query and insertion of point data in postgresql, golangpostgresqlGolang Custom Data Type query and insertion of point data in postgresql
The Code is as follows:
Package mainimport ("bytes" "database/SQL" "database/SQL/driver" "fmt" _ "github.com/lib/pq" "strconv" "strings ") // custom supported
PostgreSQL uses dblink to implement cross-database query. postgresqldblink
A recent SQL statement involves joint queries between tables in different databases.
At the beginning, I learned how to write SQL statements, but failed to execute them. I need to install dblink extension first. These blog posts are not clear. Thanks for your advice. In windows, you only need to execute the SQL statement "create exte
Tags: src query mode postgres Type here from a JSON-formatted POSBusiness extension fields are often stored in the database using JSON-formatted data, which involves a headache, assuming that a value in the extension field should be used as a query condition, and PostgreSQL itself supports this query.Example: Suppose the Business extension field ext_data the JSON
Tags: PostgreSQL timestamp date Query date range queryThere are several ways to query by date range, and the Date field type is typically: without timezone Method One: select * from user_info where create_date >= ‘2015-07-01‘ and
create_date ‘2015-08-15‘; Method Two: select * from user_info where
create_date between ‘2015-07-01‘ and ‘2015-08-15‘; Method Three:
result set type returned by the subquery is a simple value.
b) Single-row sub-query.
The result set type returned by the subquery is 0 or one unit group. Similar to the scalar subquery, but may return 0 tuples.
c) Multiline single-row subquery.
The result set type returned by a subquery is a multi-tuple but has only one simple column.
d) Table sub-
does not have a match cannot be ignored, and it needs to be connected to an empty tuple, which is true when the correct join, full join. 3) Mj_innertupleslot: The empty tuple generated for the right child node tuple, constructed when the Mj_fillouter is true. 4) Mj_outertupleslot: The empty tuple generated for the left Dial hand node tuple, constructed when the Mj_fillinner is true. In addition to this, you need to set the variable Mj_matchedouter (mj_matchedinner) that marks the current left (
Label:
--For partition table constraint_exclusion This parameter needs to be configured as partition or on postgres=# show constraint_exclusion;
Constraint_exclusion----------------------Partition--Creating a parent-child table for storing partition data create TABLE t (ID int primary key);
CREATE table T1 (like T including all) inherits (T);
CREATE TABLE T2 (like T including all) inherits (T);
CREATE table t3 (like T including all) inherits (T);
CREATE table t4 (like T including all) inherits
Database optimization tutorial (3) Slow query of records and database optimization tutorial Query1. Slow query foundIn the previous section, we made data preparation for slow queries. This section allows us to find slow queries and record them to files.
3. Slow query of reco
Database optimization tutorial (3) Slow query of records and database optimization tutorial Query1. Slow query foundIn the previous section, we made data preparation for slow queries. This section allows us to find slow queries and record them to files.
3. Slow query of reco
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.