Simplifying Queries
Hi, I have two query series that I wonder whether they can be compacted into a single query: FIRST QUERY SERIES cursor.execute(select d.ID, d.Name, b.SupersetID from books_data as d join books as b on d.ID=b.BooksDataID2 where b.BooksDataID!=b.BooksDataID2 and b.ReligionsID=%s, (rel_id,)) tmp = cursor.fetchall() cursor.execute(select d.ID from books_data as d join books as b on d.ID=b.BooksDataID2 join books_compilations as c on d.ID=c.BooksDataID where b.ReligionsID=%s, (rel_id,)) junk_ids = [itm[0] for itm in cursor] poss_books_data = [] for id, name, ss_id in tmp: if id not in junk_ids: poss_books_data.append([id, name, ss_id]) SECOND QUERY SERIES cursor.execute(select ReligionsID from books where BooksDataID=%s, (tmp_ids[0],)) rel_id = cursor.fetchone()[0] # The first entry will always give the correct value cursor.execute(select d.ID, d.Name, b.SupersetID from books_data as d join books as b on d.ID=b.BooksDataID2 where b.BooksDataID!=b.BooksDataID2 and b.ReligionsID=%s, (rel_id,)) tmp = cursor.fetchall() cursor.execute(select d.ID from books_data as d join books as b on d.ID=b.BooksDataID2 join books_compilations as c on d.ID=c.BooksDataID where b.ReligionsID=%s, (rel_id,)) I don't know that they're necessary, but here are the table definitions: mysql describe books; +-++--+-+-++ | Field | Type | Null | Key | Default | Extra | +-++--+-+-++ | ID | int(11)| NO | PRI | NULL| auto_increment | | ReligionsID | int(11)| NO | MUL | NULL|| | PrimaryReligion | tinyint(1) | YES | | 0 || | BooksDataID | int(11)| NO | | NULL|| | BooksDataID2| int(11)| YES | | NULL|| | SupersetID | int(11)| YES | | NULL|| +-++--+-+-++ 6 rows in set (0.09 sec) mysql describe books_data; ++-- ---+--+-+-+- ---+ | Field | Type | Null | Key | Default | Extra | ++-- ---+--+-+-+- ---+ | ID | int(11) | NO | PRI | NULL| auto_increment | | Name | varchar(30) | NO | | NULL| | | Label | enum('Cannonised','Uncannonised, fully accepted','Uncannonised, \ n not fully accepted','Uncannonised, controversial') | NO | | NULL || | PrimaryKey | tinyint(1) | YES | | 0 | | ++-- ---+--+-+-+- ---+ 4 rows in set (0.13 sec) mysql describe books_compilations; +-+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +-+-+--+-+-++ | ID | int(11) | NO | PRI | NULL| auto_increment | | Name| varchar(30) | NO | | NULL|| | SupersetID | int(11) | NO | | NULL|| | BooksDataID | int(11) | NO | | NULL|| +-+-+--+-+-++ 4 rows in set (0.20 sec) TIA, Savi -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Cannot build static mysql server
I try to cpmpile mysql-with no shared, but have an error when configuring: mkdir -p ~/src/mysql/bld \ cd ~/src/mysql/bld \ (make clean; rm ~/src/mysql/bld/CMakeCache.txt; echo 1) \ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/mysql -DBUILD_CONFIG=mysql_release -DMYSQL_DATADIR=data -DSYSCONFDIR=etc \ -DWITH_LIBWRAP=on -DIGNORE_AIO_CHECK=on \ -DWITH_ZLIB=bundled -DENABLE_GCOV=on -DENABLE_GPROF=yes -DWITH_PIC=on \ -DENABLED_LOCAL_INFILE=on -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DINSTALL_LAYOUT=STANDALONE \ -DWITH_EDITLINE=bundled -DENABLED_PROFILING=ON -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EMBEDDED_SERVER=on -DWITH_INNOBASE_STORAGE_ENGINE=on -DWITH_ARCHIVE_STORAGE_ENGINE=on \ -DWITH_BLACKHOLE_STORAGE_ENGINE=on -DWITH_PERFSCHEMA_STORAGE_ENGINE=on -DWITH_FEDERATED_STORAGE_ENGINE=on \ -DWITH_PARTITION_STORAGE_ENGINE=on -DWITHOUT_EXAMPLE_STORAGE_ENGINE=on -DWITH_EXTRA_CHARSETS=all \ -DWITH_INNODB_MEMCACHED=on -DWITH_LIBEVENT=bundled -DCPACK_MONOLITHIC_INSTALL=on \ -DWITH_SSL=bundled -DWITH_PIC=on -DCMAKE_BUILD_TYPE=MinSizeRel -DENABLE_DEBUG_SYNC=off \ -DENABLE_MEMCACHED_SASL=on -DENABLE_MEMCACHED_SASL_PWDB=on -DFEATURE_SET=community \ -DCMAKE_SKIP_RPATH=on -DCMAKE_USE_RELATIVE_PATHS=on -DDISABLE_SHARED=on \ -DWITH_MYSQLD_LDFLAGS=-L/opt/cyrus-sasl/lib \ -DCMAKE_C_FLAGS=-fPIC -fPIE -static-libgcc -static-libstdc++ \ -DCMAKE_CXX_FLAGS=-fPIC -fPIE -I/opt/cyrus-sasl/include The error is: -- LIBEVENT_LIBRARY event CMake Error at plugin/innodb_memcached/daemon_memcached/CMakeLists.txt:87 (TARGET_LINK_LIBRARIES): Cannot specify link libraries for target libmemcached which is not built by this project. Of I specify -DWITH_INNODB_MEMCACHED=off, then configure passes and can compile the project. What is the problem? -- Mimiko desu. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
MySQL Cluster 7.3.6 has been released
Dear MySQL users, MySQL Cluster is the distributed, shared-nothing variant of MySQL. This storage engine provides: - Real-time performance based on in-memory storage (with checkpointing to disk) - Read write scalability through transparent auto-sharding - 99.999% High Availability with no single point of failure and on-line maintenance - SQL and NoSQL API (including C++, Java, http, Memcached and JavaScript/Node.js) - Active-Active/Multi-Master geographic replication MySQL Cluster 7.3.6, has been released and can be downloaded from http://www.mysql.com/downloads/cluster/ where you will also find Quick Start guides to help you get your first MySQL Cluster database up and running. The release notes are available from: http://dev.mysql.com/doc/relnotes/mysql-cluster/7.3/en/mysql-cluster-news-5-6-19-ndb-7-3-6.html http://dev.mysql.com/doc/relnotes/mysql-cluster/7.3/en/mysql-cluster-news-5-6-17-ndb-7-3-5.html MySQL Cluster enables users to meet the database challenges of next generation web, cloud, and communications services with uncompromising scalability, uptime and agility. More details can be found at http://www.mysql.com/products/cluster/ Enjoy ! Changes in MySQL Cluster NDB 7.3.6 (5.6.19-ndb-7.3.6) (2014-07-11) MySQL Cluster NDB 7.3.6 is a new release of MySQL Cluster, based on MySQL Server 5.6 and including features from version 7.3 of the NDB storage engine, as well as fixing a number of recently discovered bugs in previous MySQL Cluster releases. Obtaining MySQL Cluster NDB 7.3. MySQL Cluster NDB 7.3 source code and binaries can be obtained from http://dev.mysql.com/downloads/cluster/. For an overview of changes made in MySQL Cluster NDB 7.3, see MySQL Cluster Development in MySQL Cluster NDB 7.3 (http://dev.mysql.com/doc/refman/5.6/en/mysql-cluster-development- 5-6-ndb-7-3.html). This release also incorporates all bugfixes and changes made in previous MySQL Cluster releases, as well as all bugfixes and feature changes which were added in mainline MySQL 5.6 through MySQL 5.6.19 (see Changes in MySQL 5.6.19 (2014-05-30) (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-19.html)). Functionality Added or Changed * Cluster API: Added as an aid to debugging the ability to specify a human-readable name for a given Ndb object and later to retrieve it. These operations are implemented, respectively, as the setNdbObjectName() and getNdbObjectName() methods. To make tracing of event handling between a user application and NDB easier, you can use the reference (from getReference() followed by the name (if provided) in printouts; the reference ties together the application Ndb object, the event buffer, and the NDB storage engine's SUMA block. (Bug #18419907) Bugs Fixed * Cluster API: When two tables had different foreign keys with the same name, ndb_restore considered this a name conflict and failed to restore the schema. As a result of this fix, a slash character (/) is now expressly disallowed in foreign key names, and the naming format parent_id/child_id/fk_name is now enforced by the NDB API. (Bug #18824753) * Processing a NODE_FAILREP signal that contained an invalid node ID could cause a data node to fail. (Bug #18993037, Bug #73015) References: This bug is a regression of Bug #16007980. * When building out of source, some files were written to the source directory instead of the build dir. These included the manifest.mf files used for creating ClusterJ jars and the pom.xml file used by mvn_install_ndbjtie.sh. In addition, ndbinfo.sql was written to the build directory, but marked as output to the source directory in CMakeLists.txt. (Bug #18889568, Bug #72843) * Adding a foreign key failed with NDB Error 208 if the parent index was parent table's primary key, the primary key was not on the table's initial attributes, and the child table was not empty. (Bug #18825966) * When an NDB table served as both the parent table and a child table for 2 different foreign keys having the same name, dropping the foreign key on the child table could cause the foreign key on the parent table to be dropped instead, leading to a situation in which it was impossible to drop the remaining foreign key. This situation can be modelled using the following CREATE TABLE statements: CREATE TABLE parent ( id INT NOT NULL, PRIMARY KEY (id) ) ENGINE=NDB; CREATE TABLE child ( id INT NOT NULL, parent_id INT, PRIMARY KEY (id), INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ) ENGINE=NDB; CREATE TABLE grandchild ( id INT,