I have a MySQL database with tables in the form of "shard_0", "shard_1", "shard_2", etc.
These are virtual shards. Now I want to add another DB server and move the even-numbered shards ("shard_0", "shard_2", "shard_4", ...) to the new machine.
What is the best way to do that? There are many tables so ideally I wouldn't have to type out...
if I run a SELECT query that returns 10 rows, is there a way to select the 2nd item in the result set right in the SELECT statement (effectively getting a single row result)?
psedudo code:
SELECT id from MYTABLE where MYTABLE.foo = 0 and RESULT_INDEX = 2;
this would return the 2nd item from a multi item result set.
...
Hello friends,
I m very impressed with the idea of stackoverflow, the way they provide the options to login to the users is very easy for any user. And if I have to do the same thing in my website then how its going to be. what will be the coding structure and coding snippets for the same in php , mysql and javascript (ajax).
http:...
I just migrated my django application from sqlite3 to mysql 5.1.41. I have a charfield in a model defined like this:
class HostData(models.Model):
Host = models.CharField(max_length=50, null=True)
HostStatus = models.CharField(max_length=200, null=True)
Alarm = models.BooleanField()
Everything works the same except HostStatus, w...
Hi I can't seem to select data from multiple tables with kohana orm.
When I do:
$obj = orm::factory('a')
->join('b')
->on('a.b_id','=','b.id')
->select ('b.','a.')
->find_all();
The only variables available in $obj are from table a. Can someone help?
...
Newbie here..
Hello there I want to install sphinx search to my CentOS 5.5.
I just need to know the commands, for the full installation.
If you could write a simple numbered manual that would be appreciated.
...
When using Tomcat with MySQL, what is the relationship between poolPreparedStatements setting in Tomcat DataSource configuration (I believe coming from DBCP) and Connector/J cachePrepStmts setting? What's the optimal configuration?
...
I'm confused
Does order matter when installing Sphinx Search. If mysql was already installed on my server, can I still install sphinx after or do I have to do them together or Sphinx before?
...
Hi I have two different tables containing lot of images.
I need to display 50 random images from both tables. How can I do like that.
How can I select random images using MySQL?
or
if I select 100 images from both tables. How can I choose 50 random images from that array using php?
any body knows the solution please help me.
...
Hi, I have these table structures and while it works, using EXPLAIN on certain SQL queries gives 'Using temporary; Using filesort' on one of the table. This might hamper performance once the table is populated with thousands of data. Below are the table structure and explanations of the system.
CREATE TABLE IF NOT EXISTS `jobapp` (
`i...
I have two table like below
CREATE TABLE IF NOT EXISTS `countries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=196 ;
ANd ANother one
CREATE TABLE IF NOT EXISTS `students` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`admission...
HI,
I have a cron that calls a basic API URL. The output is xml so I use php's file_get_contents() to get the data to process.
My question is, Does the output format of the xml make a difference in the transfer time from one server to another? The cron is running every ten minutes and I don't want the crons to overlap at some point bec...
I have a situation where I have to dynamically build a linq query based on user selections.
If I had to dynamically generate sql I could do it this way:
var sb = new StringBuilder();
sb.AppendLine("SELECT * FROM products p");
sb.AppendLine("WHERE p.CategoryId > 5");
// these variables are not static but ...
I have a form to fill which has several input fileds and 20 checkbox My question is how to organize the records of the selected checkbox in mysql and what is the best way to search for them with php. Can you give me an example?
...
Of these two designs for a crossroad database
#Street
street_id | street_nm
#Crossing
crossing_id | x | y | street_id_1 | street_id_2
VS
#Street
street_id | street_nm
#Crossing
crossing_id | x | y
#street crossing relationship
street_id | crossing_id
Assuming every crossing has only exactly two roads, is there a reason why one wou...
Possible Duplicate:
Alter MYSQL Table To Add Comments on Columns
Hi Guys,
I googled all over the place but I can't find the answer. I know you can add comments to your database columns. I already created a table but now i want to add comments to certain columns, my database programma (sequel pro) doesn't have a function to al...
i want to display all users which are below my status.
the lead_id shows my id if i'm the manager. all users when registering will have to put the person in charge id(lead-id)
but in my case, i'm getting only users with my id.
e.g
id name leadid
1 xxx 0
2 aa 1
3 sdd ...
It seems as if MySQLdb is restricting the maximum transfer size for SQL statements. I have set the max_allowed_packet to 128M for mysqld. MySQL documentation says that this needs to be done for the client as well.
...
I can't seem to find an explanation for this and I'm pretty sure that it has previously worked as expected.
SELECT CAST(-1 AS UNSIGNED INTEGER);
Expected: 0
Result: 18446744073709551615
Am I confused, has something changed, or is this a MySQL bug?
...
Hi,
I'm writing a query where I group a selection of rows to find the MIN value for one of the columns.
I'd also like to return the other column values associated with the MIN row returned.
e.g
ID
QTY
PRODUCT
TYPE
12
Orange
Fruit
2
4
Banana
Fruit
3
3
Apple
Fruit
If I GROUP this table by the column 'TYPE' and select the ...