comp.databases.mysql
  Home FAQ Contact Sign in
comp.databases.mysql only
 
Advanced search
January 2010
mo tu we th fr sa su w
    123 53
45678910 1
11121314151617 2
18192021222324 3
25262728293031 4
2010
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2010 2008 2007 2006
total
comp.databases.mysql Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: Multiple indexes         


Author: Jason Carlton
Date: Jan 29, 2010 10:19

On Jan 28, 8:59 am, "Peter H. Coffin" ninehells.com> wrote:
> On Thu, 28 Jan 2010 02:09:11 -0800 (PST), Jason Carlton wrote:
>> On Jan 28, 2:00 am, "Erick T. Barkhuis"
>> wrote:
>>> Jason Carlton:
>
>>>>I have 2 different scripts that query the same table. One script
>>>>queries based on 3 columns, and the other queries based on 13 columns
>>>>(out of 20 total columns).
>
>>>>Should I have an index for the first query with those 3 columns, and
>>>>then another index with all 13 columns?
>
>>> What happens if you don't define any indexes?
>
>>> --
>>> Erick
>
>> I originally didn't have any indexes, but then during peak times, my
>> site would slow down to a crawl. It's not uncommon for several hundred ...
Show full article (4.50Kb)
no comments
  Re: Multiple indexes         


Author: The Natural Philosopher
Date: Jan 29, 2010 05:00

Axel Schwenke wrote:
> Captain Paralytic yahoo.com> wrote:
>> On 28 Jan, 13:10, The Natural Philosopher
>
>>> what about using multiple indices?
>>> One for every uniquely searchable column?
>> This is known as a "fully inverted database". However its use in this
>> context may be limited. Remember that MySQL will use only 1 index.
>
> This is not true any more. Beginning with 5.0.something, MySQL knows
> the "index merge" access method. Here MySQL uses multiple indexes to
> lookup different conditions from the WHERE clause and intersects /
> unifies the results.
>
> See: http://dev.mysql.com/doc/refman/5.1/en/index-merge-optimization.html
>

I am glad you said that, because it seemed to me that it was doing
something of the sort.
Show full article (0.90Kb)
no comments
  strange extra column         


Author: Derek Turner
Date: Jan 28, 2010 21:53

Crossposted from alt.php, follow-up set there.


function procAdd($tableName, $fields, $vals){
//generates INSERT query, applies to database
global $conn;

$output = "";
$query = "INSERT into $tableName VALUES (";
foreach ($vals as $theValue){
$query .= "'$theValue', ";
} // end foreach

//trim off trailing space and comma
$query = substr($query, 0, strlen($query) - 2);

$query .= ")";
$output = "query is $query
\n";

Show full article (1.09Kb)
no comments
  Re: LIKE and REGEXP ..get all alphanumeric         


Author: SM
Date: Jan 28, 2010 18:52

On 28 ene, 12:43, Captain Paralytic yahoo.com> wrote:
> On 28 Jan, 17:30, SM gmail.com> wrote:
>
>
>
>> On 28 ene, 12:03, Captain Paralytic yahoo.com> wrote:
>
>>> On 28 Jan, 16:38, SM gmail.com> wrote:
>
>>>> On 28 ene, 11:17, Captain Paralytic yahoo.com> wrote:
>
>>>>> On 28 Jan, 16:02, SM gmail.com> wrote:
>
>>>>>> Hello
>>>>>> I'm trying to create a query that gets the first alphanumeric
>>>>>> character...
>
>>>>>> I have cd tracks like this:
>>>>>> Good Morning
>>>>>> America The Lovely ...
Show full article (2.87Kb)
7 Comments
  Re: convert result set from utf-8 to latin         


Author: Peter H. Coffin
Date: Dec 26, 2008 16:52

On 19 Dec 2008 15:49:32 GMT, End of Road wrote:
> Hello,
>
> I am retrieving data from a remote database in which text data is
> stored in the utf-8 charset, this data is meant to be displayed and
> generally used on pages that use the latin1 charset (ie iso-8859-1).
> I know I can go through the result set and translate text data to
> latin but on some occasions (for instance when I plug the data in a
> form) it would be much more convenient (let alone faster) to have the
> result already converted to latin. Is it just a matter of changing the
> collation on a per-query basis? How would I go about achieving this?

Set your output connection to the charset that you want the data
converted to. That'll mean reading and understanding
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html very
well, and writing your applications to account for possible data loss
from characters in the database that don't fit into latin1 mapping.
Show full article (1.09Kb)
no comments
  REGEXP and CREATE TRIGGER         


Author: D A V E
Date: Dec 26, 2008 16:51

Always use manualy Query
(UPDATE table SET column = replace(column,"-","") WHERE `column` REGEXP '-')

My question:
How to build a "trigger" for the update database which removes the sign "-"?
1 Comment
  Is there a better way?         


Author: Bill H
Date: Dec 26, 2008 13:27

I am relativly new to MySql so I may be doing this wrong. On a site I
am working on I have a table called block that looks like this:

primary key (auto inc)
owner id (key to account table)
blocked id (key to account table)

Where owner id and blocked id are keys into an account table.
The table has indexes on both the owner id and blocked id fields.

This table is used for users to block contact from other users. For
example if user id #1 didn't want to be contacted by user id #2 then
there would be an entry in the table where owner id = 1, and blocked
id = 2.

For a user to see all the users he has blocked I would select all rows
where owner id = the user who wants to know.

To test if a user is blocked from contacting another user I would
select where the owner id = user to be contacted and blocked id = user
who wants to contact.

This all seems straight forward and logical. The following is where I
wonder if I am doing it right.
Show full article (1.61Kb)
5 Comments
  Re: Is there a better way?         


Author: Jerry Stuckle
Date: Dec 26, 2008 12:31

Bill H wrote:
> On Dec 26, 5:32 am, Jerry Stuckle attglobal.net> wrote:
>> Bill H wrote:
>>> On Dec 26, 7:39 am, Luuk wrote:
>>>> Bill H schreef:
>>>>> I am relativly new to MySql so I may be doing this wrong. On a site I
>>>>> am working on I have a table called block that looks like this:
>>>>> primary key (auto inc)
>>>>> owner id (key to account table)
>>>>> blocked id (key to account table)
>>>>> Where owner id and blocked id are keys into an account table.
>>>>> The table has indexes on both the owner id and blocked id fields.
>>>>> This table is used for users to block contact from other users. For
>>>>> example if user id #1 didn't want to be contacted by user id #2 then
>>>>> there would be an entry in the table where owner id = 1, and blocked
>>>>> id = 2.
>>>>> For a user to see all the users he has blocked I would select all rows
>>>>> where owner id = the user who wants to know.
>>>>> To test if a user is blocked from contacting another user I would
>>>>> select where the owner id = user to be contacted and blocked id = user ...
Show full article (3.52Kb)
no comments
  Re: Is there a better way?         


Author: Jerry Stuckle
Date: Dec 26, 2008 11:32

Bill H wrote:
> On Dec 26, 7:39 am, Luuk wrote:
>> Bill H schreef:
>>
>>
>>
>>
>>
>>> I am relativly new to MySql so I may be doing this wrong. On a site I
>>> am working on I have a table called block that looks like this:
>>> primary key (auto inc)
>>> owner id (key to account table)
>>> blocked id (key to account table)
>>> Where owner id and blocked id are keys into an account table.
>>> The table has indexes on both the owner id and blocked id fields.
>>> This table is used for users to block contact from other users. For
>>> example if user id #1 didn't want to be contacted by user id #2 then
>>> there would be an entry in the table where owner id = 1, and blocked
>>> id = 2.
>>> For a user to see all the users he has blocked I would select all rows ...
Show full article (2.79Kb)
4 Comments
  Re: 'commit' in slow query log?         


Author: Jerry Stuckle
Date: Dec 26, 2008 00:24

flycondor wrote:
> when I execute a sql of insert/update
>
>
> On 12月25日, 上午2时51分, Luuk wrote:
>> flycondor schreef:
>>
>>> I found many 'commit' in my slow query log
>>> does anyone know what's matter?
>>> example :
>>> # Time: 081223 23:40:49
>>> # User@Host: [user] @ appserver [192.168.1.5]
>>> # Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
>>> commit;
>> (http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html)
>> "The slow query log consists of all SQL statements that took more than
>> long_query_time seconds to execute and "
>>
>> and COMMIT, is a SQL statement...
>> ...
Show full article (1.37Kb)
no comments
1 2 3 4 5 6 7 8 9