mysql

How do you identify unused indexes in a MySQL database?

I have recently completely re-written a large project. In doing so, I have consolidated great number of random MySQL queries. I do remember that over the course of developing the previous codebase, I created indexes on a whim, and I'm sure there are a great number that aren't used anymore. Is there a way to monitor MySQL's index usage...

PHP MySQL Query most popular in last 24 hours

Say I want to get ten records with the MOST likes in the last 24 hours. Here's what I have so far: $date = date("o-m-d"); $query = "SELECT date_created,COUNT(to),from,to FROM likes WHERE date_created LIKE '$date%' GROUP BY to ORDER BY COUNT(to) DESC LIMIT 10"; The problem with that is that it only gets the most liked from THAT DAY, no...

how access mysql remote database in iphone

hi all, i m using remote mysql database in my application. please give any idea how i connect the mysql remote database. i search many references but i have not get any exact soln for it. ...

Large Database management using C#

We are using MySQL to get data from database, match the data and send back the matched data to user. The MySQL Db contain 10 table , 9 tables are having less data which needed to be matched with 10th table which has 25 Million records and still adding. I need to create C# application to match the data and send to user. After every 1 min,...

problem connecting with odbc mysql in vb.net

I'm trying another method to connect mysql and vb.net. I didn't have any difficulties connecting mysql and vb.net when using mysql net connector. And I also used the same codes. I just replaced the ones that needed to be replaced with odbc. Imports System.Data.Odbc Public Class globalclass Private cn As New OdbcConnection("DSN=k...

Cant figure out how to join these tables

Need help with some kind of join here. Cant figure it out. I want to loop out the forum boards, but I also want to get last_post and last_posterid from posts, and based on last_posterid get username from users. This is how far I've come yet (:P): SELECT name, desc, position FROM boards b INNER JOIN posts p ON ??? INNER JOIN users u ON...

How do I integrate date check function in single mysql query??

this is my current function: $result = $db->sql_query("SELECT * FROM data1,data2,data3,data4 WHERE person='" .$name. "'"); $row = $db->sql_fetchrow($result); $day = $row['regtime']; $days = (strtotime(date("Y-m-d")) - strtotime($row['regtime'])) / (60 * 60 * 24); if($row > 0 && $days < 15){ $row = ['name']; $row = ['age']; //etc bu...

md5 hash for urls in unique Index

I was asked this before with slight different with current question. but did not got the answer I was looking into. My question is do I need to store md5($url) in unique index in MySQL?? I have seen this in some code actually I don't remember..this is a large database with more than 5 million urls and the indexing is done by calling url...

how access mysql remote database

hello, i m creating inapp purchage subscription module, in this app i want to access remote database but problem is that how i connect my objective-c code with the mysql on the server, i am not found any sufficient refrence please help me if any refrence or solution is there. ...

Do MySql Connector J JDBC drivers not support connection pooling?

Does Connector J really not support connection pooling. Looking at their documentation I have to download a 3rd party library such as DBCP or c3p0 to get this right. What is the motivation for not introducing it in the Connector J driver itself? Is this something that the J2EE spec dictates? ...

How can we use mysql's limits with iBatis generally?

I use iBatis 2.3.4 I have the following query: <select id="getUserList" resultMap="userListResult"> SELECT id, name, login, email FROM users </select> And when I need to provide paging I use: sqlMap.queryForList("base.getUserList", startPosition, numItems); Then iBa...

Named parameters order has sense for MySql .Net data provider?

I found that in my project order of named parameter has sense. I call this procedure CREATE PROCEDURE `test`.`TestProc` ( in myText varchar (5), in myText2 varchar (100) ) BEGIN END If I add parameters like this: command.CommandText = "testProc"; command.CommandType = System.Data.CommandType.StoredProcedure; comm...

what is the difference between UNIQUE INDEX and UNIQUE KEY??

I have seen couple of sample tables one is with UNIQUE INDEX and other is with UNIQUE KEY. what is the difference between two?? or both are same? ...

Mysql Replication

Hi I want to be able to replicate a local mysql db to an online mysql db over adsl. My adsl ip is dynamic, so I dont have static ip. I use a custom application to fill the local db, the app uses quite a lot of cpu and the on webserver that hosts the online db is suffering when I run the app online. Is there any way to do this ? Than...

Autoincrement of table id using string combination in database automatically

We know that id of any table is of integer type and auto-increment in that table is fine. But my problem is that i want to increment a combination of string and integer. For example String : ABC is the starting code for the unique id. First Id of my table should be primary key and ie ABC10001, ABC10002,..... and so on. Without using ...

DB design: one large DB for all customers or many small DBs

Looking for any suggestions or advise or even best practices. I have developed an online database using php and mysql. It allows companies to log complaints and resolutions etc. There is a user database for login and a cip database for logging the main data. 2 companies are trialing and testing the database. At the moment each compan...

MySQL: list of sum for several conditions in one SQL statement

Hello to all! I have a problem with a MySQL statement: select sum(x) as "sum", "01.06.2010" as "date" from ( select distinct a.id as ID, a.dur as x from b_c inner join c on b_c.c_id = c.id inner join a on c.id = a.c_id inner join a_au on a.id = a_aud.id inner join d on a_au.rev = d.rev where ...

PHP: exit and show alert when looping a very long function is not responding...

I have this big function (1300+ lines of code) that takes data from the web and insert it into a local database. Each time the function runs its takes something like 20 seconds to complete and I need to run this function like a million times, so I use set_time_limit(0) to set the PHP time limit to infinite and I loop the function a milli...

[python] mysqldb rowcount bug?

Hello I've got some problems with a script I'm writing. #!/usr/local/bin/python import MySQLdb ConvDB = MySQLdb.Connect(host="1.1.1.1", user="123", passwd="123", db="somedb") ConvDBcursor = ConvDB.cursor() query="SELECT id from sometable WHERE somethng=63" print query ConvDBcursor.execute(query.decode('cp1251').encode('utf8')) print...

how to work on mysql date fomat ?

Hi What is the problem with the mysql syntax SELECT FORMAT(dCreatedDate,'YYYY-MM-DD') as date1 FROM tbl_book_self I want to select the date from mysql database in this format,How to use this syntax ...