MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

6
votes
4answers
487 views

Purpose of IDs in a User Table Database

In a table, such as a user table, where there will only be 1 row with a for any particular user, why have an ID field, let alone as the primary key?
5
votes
4answers
4k views

MySQL: Index when joining to tables not being used (Performance optimizing question)

I need to optimize the following query: SELECT /* [things omitted] */ articles.blogpost_id, articles.id AS articleid FROM blogposts JOIN articles ON articles.blogpost_id = blogposts.id WHERE ...
4
votes
4answers
455 views

How much will using a varchar(15) PK affect my tables performance?

I am parsing log file lines from a legacy, proprietary application into a nice easy to query DB. The log lines have no unique integer ID. They do have a UNIX timestamp as an 8 character hex string. ...
20
votes
4answers
6k views

Why does MySQL not have hash indices on MyISAM or InnoDB?

I have an application that will only select on equality, and I figure I should use a hash index over a btree index. Much to my dismay, hash indices are not supported on MyISAM or InnoDB. What's up ...
7
votes
3answers
3k views

Does making a field unique make it indexed?

If I make a unique constraint on a field, do I also need to make an index on that field in order to get a scalable insert time? Or is this done for me (even if the index it uses isn't publicly ...
3
votes
1answer
171 views

Mysql constraint problem

I'm using MySQL5.5 and for this question I have 3 simple tables t1, t2 & t3 designed like this: +------------+ +------------+ +------------+ | t1 | | t2 | | t3 | ...
1
vote
1answer
169 views

What is the 'repair code' in MySQL?

OK I was adding an index to a table, and I checked on progress using show processlist and under state it output Repair by sorting. From the MySQL docs: Repair by sorting The repair code is ...
5
votes
2answers
261 views

Database replication with ability to revert to previous states

I want to setup a development database such that it'll initially be a mirror of the database used in production. At fixed points during the day (maybe midnight or something) and/or manually, I want ...
3
votes
1answer
2k views

Amazon SimpleDB or Amazon RDS?

I'm at a deciding point in my project of whether to implement the database using SimpleDB or Amazon RDS. The database needs to be accessed through an iPhone app and as well through a website. Here are ...
5
votes
1answer
724 views

Does MySQL still handle indexes in this way?

Dropping a duplicate index in MySQL was taking rather long, so while I was waiting I searched about it & found this post from 2006, talking about how MySQL handles ADD and DROP index. If a ...
6
votes
5answers
2k views

From a set of values, how do I find the values not stored in a table's column?

I have a table which will potentially store hundreds of thousands of integers desc id_key_table; +----------------+--------------+------+-----+---------+-------+ | Field | Type | ...
3
votes
1answer
88 views

Pure (My)SQL transformations

I'm trying to promote the usage of a database versioning system (http://code.google.com/p/flyway/) on the project I'm currently working on - and to that end when we make changes to the database, we're ...
0
votes
1answer
911 views

Entity Relationship Model for linked tables

Certainly a noobish question, but I'll ask it anyway. Perhaps someone else will be thankful. ^^ I am getting warmed up with MySQL and I try to understand the concepts of creating well structured ...
4
votes
1answer
301 views

How do I use the POSIX character classes upper and lower to search text in MySQL?

I would like to search a body of text to find out when a specific word has been upper cased. MySQL has a REGEXP function with the POSIX character class [[:upper:]], but for the life of me I can't get ...
3
votes
1answer
3k views

How do I make MySQL auto increment in random order?

I have a table that contains several keys into other tables (where each key is comprised of multiple columns). I would like to create a new column for each key that would be an integer such that ...
1
vote
1answer
414 views

Can I export a MySQL schema to latex? [closed]

I have asked this question on SO before, but did not get a good answer. I would like to be able to export a MySQL schema to a set of Latex tables. phpMyAdmin does this, but it is buggy and does not ...
1
vote
1answer
185 views

MySQL queries in SQL-Server?

How can we best use our existing MySQL queries with SQLserver? Alternately, what type of changes do we need when we are converting our database server from MySQL to SQLServer?
3
votes
2answers
394 views

What are the key points to avoid table locks?

MySQL is using at my company and most of the database administration works on trying to solve the table locks. What are the key points to avoid table locks(I mean at database side and even at software ...
2
votes
1answer
1k views

No results for match…against in boolean mode search with fulltext index (MySQL)

We have a column with a fulltext index, and are matching 'asp.net' against the column in boolean mode. We know there are records where this column contains the value 'asp.net', but the query is ...
1
vote
2answers
578 views

Sizing MySQL Database Servers for Drupal

What are some guidelines to follow when it comes to sizing MySQL Servers? CPUs, RAM, Disk Space, Clock Speeds, etc? We're going to go with either the community edition or the enterprise edition, and ...
3
votes
1answer
67 views

Database appearing in one tool but not another

Can anyone think of a reason why a mySQL database would be accessible from one tool (phpMyAdmin, logged in as db_user) but not from another (Sequel Pro, logged in as db_user). The user is the same in ...
2
votes
2answers
348 views

How to get a user's friends' names?

I have a users table and friends table. The user with ID 1 has 4 friends (with IDs 2,3,4,13). I want to get names and surnames of users 2,3,4 and 13. I can to it with standard queries but it will slow ...
1
vote
1answer
386 views

Use order from another select clause

So what I'm actually trying to achieve is filter the most voted on stories. The stories are saved in one table, and all of the votes in another one. I have this statement to get the vid column order ...
4
votes
2answers
690 views

How to retrieve granted privileges without access to the database “mysql”?

As a MySQL user without access to the mysql database, is it possible to retrieve my privileges?
7
votes
4answers
4k views

How do I do a complex GROUP BY in MySQL?

I have a table that contains several keys into other tables (where each key is comprised of multiple columns). I would like to be able to group rows together that have an equal key, but I don't want ...
4
votes
2answers
575 views

More table or more database for better performance?

Lets say 1 website need 10 database table to work and i want a database pool that 40.000+ website will be inside. Which option is better for server performance? 1) 400 databases each have 1000 ...
5
votes
1answer
5k views

MySQL high availability, failover and replication with Latency

We are in the process of implementing a new CMS (Drupal 6.x) that runs on MySQL. We have two data centers -- primary and secondary -- with known latency between them. We're unsure which version of ...
4
votes
4answers
964 views

Is tuning the innodb_buffer_pool_size important on Solaris ZFS?

We're running a moderate size (350GB) database with some fairly large tables (a few hundred million rows, 50GB) on a reasonably large server (2 x quad-core Xeons, 24GB RAM, 2.5" 10k disks in RAID10), ...
1
vote
1answer
2k views

One MySQL user from 2 hosts not on same subnet

I've googled around for this with no luck. I have a master database with one slave. The perms for the slave are set and it runs fine. I'd like to add another slave using a clone of the original ...
7
votes
2answers
11k views

How to use prepared statements within MySQL stored procedures?

I'm using mysql and I need to somehow use the column curid returned by the prepared statement in the later query. I use prepared statements because as I've read, it is the only way to pass a variable ...
4
votes
1answer
2k views

nest SELECT in INSERT

I'm trying to do something like: INSERT INTO stories (vid, ip, body, timestamp) VALUES ( (SELECT vid+1 FROM stories ORDER BY vid DESC LIMIT 1), INET_ATON('127.0.0.1'), 'test', ...
15
votes
6answers
6k views

Storing IP address

I have to store the IP address of all registered users in the database. I am wondering, how many characters should I declare for such a column? Should I support IPv6 as well? If so, what is the ...
7
votes
1answer
203 views

Are relations slower than a big, inefficient table?

I've been asked in my job to violate the first normal form (repeating groups across columns, using empty / null values) several times, "for the sake of computer processing power". In a nutshell, a ...
2
votes
2answers
556 views

Is there a way to have MySQL GROUP BY utilize trailing whitespace?

I recently had an issue come up where I noticed that MySQL would ignore trailing whitespace when issuing a GROUP BY. Here's the table: CREATE TABLE `myTable` ( `id` int(10) unsigned NOT NULL, `foo` ...
5
votes
3answers
894 views

MySQL client believes they're in a transaction, gets KILLed, wreaks havoc

Open up two mysql command-line clients and connect to your database. In client #1, enter START TRANSACTION; In client #2, use SHOW PROCESSLIST, then KILL [n]; where n is the id for client #1's ...
0
votes
2answers
493 views

How wrong is my web app modeling schema?

So, I'm about to write a quite simple web application, I am currently working actively on the database schema, and I need help to avoid major drawbacks. I've been programming (php) for a few years ...
3
votes
2answers
2k views

MySQL 5.5.9 Wont Start

I installed mysql version 5.5.9 on my mac and I tried to start it using this command : sudo /usr/local/mysql/support-files/mysql.server start mysql didn't start with this command. I checked the ...
2
votes
3answers
239 views

multi-table mysql query

I am trying to make a multi-table query that I am not quite sure how to do properly. I have User, Message, Thread, and Project. A User is associated with Message/Thread/Project as either the Creator ...
2
votes
1answer
693 views

Query between two related tables

I have two tables. One of them (user_profile table) has a field named "user_profile_id" and the other one (user_friend table) has two fields named "user_profile1_id" and "user_profile2_id" which are ...
2
votes
1answer
267 views

databases/tables with nonconventional names

Disclaimer: not an administrator How does one deal with non-kosher names such as 'data?base' ? I'm always one to ensure the cleanliness of my databases, but after finally installing phpmyadmin to ...
0
votes
1answer
203 views

How to design databases? [closed]

Describe the process in steps, please. What tools do you use for it?
2
votes
1answer
574 views

Question on Design for User + User Groups + User Types + Subscriptions Model

I am redeveloping an existing web application with both weak source code and a weak underlying database design. I'm trying to develop things in a way that future expansion will be much easier, ...
4
votes
2answers
1k views

After I kill my clients, MySQL continues to process queries for hours

Hi I have a MySQL db with 10 million rows with lots of triggers. A php client connects to mysql and INSERT's hundreds of rows per second. When the client has been running for hours, and I terminate ...
3
votes
1answer
436 views

Any reasons at all *not* to use MySQL in this scenario

I want to know if there is any reasons at all not to use MySQL in this scenario. 2 servers behind a virtual IP with MySQL master-master replication Goal: redundancy, want this to run 24/7 ...
0
votes
1answer
617 views

One record, multiple updates in one query (MySQL)

I run into a problem for which I didn't find an answer anywhere: If I have a table in which one specific value(here amount) from multiple records can add into a target record(from the same table), can ...
1
vote
1answer
716 views

Multilingual Dictionary Database question

Let's say someone is coding a multilingual dictionary in PHP, and he wants to let people submit both words and definitions in English and Spanish, but wants to track it so they can be filtered. ...
2
votes
1answer
426 views

MySQL MyISAM Table Locking and Delayed Inserts for Webserver Access Logs

We will install a webserver that writes access logs to a MySQL table. Access logs of course will get really really big, so this will be a separate MySQL instance from the regular data and we will more ...
2
votes
2answers
353 views

Will this Database design logic work and what should be used?

A few weeks ago I had a client of mine ask me about how complex it would be to develop a custom CRM application similar to the one being provided by highrisehq.com What he essentially wants to do is ...
3
votes
3answers
495 views

Storing a large number of small size entries in MySQL

I have a database that stores readings from numerous gauges. Depending on the gauge, there may be data for that gauge every 1-5 minutes with multiple readings (i.e.- weather station and it stores 5 ...
3
votes
3answers
489 views

What kind of hardware/software config should I look at for a MySQL database with 10,000 plus tables

I am looking at rolling out a CMS system that will require the creation of around 10,000 tables within the primary MySQL database of the system. The database will be the data store for several ...