PostgreSQL code analysis, query optimization, canonicalize_qual, postgresql
Here, we have finished sorting out the part of the regular expression. The reading order is as follows:
I. PostgreSQL code analysis, query optimization, canonicalize_qual
Ii.
PostgreSQL code analysis, query optimization, process_duplicate_ors, postgresql
PostgreSQL code analysis and query optimization.
/** Process_duplicate_ors * Given a list of exprs which are ORed together, try to apply * the inverse OR distributive law. ** Returns the resu
Five tips for Instagram to improve PostgreSQL performance, postgresql Performance Optimization
As Instagram grows, Postgres continues to serve as a solid foundation for Instagram and stores a vast majority of user data. Less than a year ago, we also wrote on our blog that Instagram "stores a large amount of data" and adds 90 pieces of data per second. Now, this d
Java SQL statement optimization experience and PostgreSQL statement Optimization
Java SQL statement optimization experience
(1) select the most efficient table name sequence (only valid in the rule-based seo/'target = '_ blank'> Optimizer ):The ORACLE parser processes the table names in the FROM clause in the order FRO
In SQL, query conditions need to be divided into three types in the query optimization stage. The three types of conditions have different effects and can be converted to each other in some cases.First, describe the SQL statement execution steps, which can be divided into three steps: 1. Read the tuples in the table; 2. If join exists, join is started; 3. filter the where condition. Take simple SQL as an example:Table TBL (C1 int, C2 int, C3 INT );SQL
operations, B1 normal columns
Join optimization
Semi Join optimization + materialized (unrelated subqueries)
has not been optimized
S7
Non-correlated subquery, >= any operation, A1 index key
Join optimization
Semi Join optimization + index Scan
Specific optimizations
S8
Non-correlated subqueries,
Join
PostgreSQL code Analysis, query optimization section.A Blog:http://blog.csdn.net/shujiezhang of understandingRelated Posts: PostgreSQL code Analysis, query optimization section, process_duplicate_ors/* * Canonicalize_qual * Convert A qualification expression to the most useful form. * * The name of this routine are a h
records from a query result;Prepared Query );Use analyze to maintain accurate optimization statistics;Regular use of vacuum or pg_autovacuumDelete the index (then re-create the index) When making a large amount of data changes)2. Procedural experienceCheck whether the connection pool is used. If not, use it as soon as possible;Check the program again. After the connection is used, check whether the connection pool is returned;3. Server parameter conf
PostgreSQL Performance Optimization considerations caused by connection to IPVs that consumes cpu resources in particular. bitsCN.com
Because it is in the development stage, the postgres parameter is not configured, and the default configuration during installation is used,In the past, nothing was abnormal, but my cpu usage suddenly increased a few days ago.Check the process and find that the CPU usage of o
Tags: code analysis PostgreSQL Query optimizationPostgreSQL code Analysis, query optimization section./* * process_duplicate_ors * Given a list of Exprs which is ORed together, try to apply * the inverse OR distributive l Aw. * * Returns The resulting expression (could is an AND clause, an OR * clause, OR maybe even a single subexpression). *//* * Suppose we have four tables, each of which is test_a,test_b,
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 of data changes (then rebuilding indexes)2, program ExperienceCheck the program, whether t
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
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_name,c.department_name,c.hospital_id,c.hospita
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:
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
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
1.2.2 PostgreSQL
1.2.2.1 S6 Statement
Review the query execution plan, and the subquery is optimized (materialized so that the subquery results are cached, and the subquery is executed only once).
postgres=# EXPLAIN SELECT * from T3 WHERE b3 >= "Any" (select B1 from T1);
Nested Loop Semi Join (cost=0.00..41707.39 rows=680 width=12)
Join Filter: (t3.b3 >= t1.b1)
-> Seq Scan on t3 (cost=0.00..30.40 rows=2040 width=12)
-> materialize (cost=0.00..4
Tags: PostgreSQL optimized code Analysis readingPostgreSQL code Analysis, query optimization section.Here the parts of the canonical predicate expression are sorted out, and the order of reading is as follows:One, PostgreSQL code Analysis, query optimization section, canonicalize_qualTwo,
PostgreSQL code Analysis, query optimization section.Here the parts of the canonical predicate expression are sorted out, and the order of reading is as follows:One, PostgreSQL code Analysis, query optimization section, canonicalize_qualTwo, PostgreSQL code Analysis, query
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.