tuning stored procedures

2010-01-15 Thread Ted Yu
Hi, We currently use SQL statements embedded in Java code. I believe stored procedures would give us better performance. I found http://lists.mysql.com/maxdb/16680 which is very old. Can someone share stored procedures tuning practices ? Thanks

Re: Better that `NOT IN`

2010-01-15 Thread Dan Nelson
In the last episode (Jan 15), Daevid Vincent said: > From: Peter Brawley [mailto:peter.braw...@earthlink.net] > > Junior Ortis wrote: > > > Hi guys i have a problem, 3 big tables: item_instance about 15K rows, > > > character_inventory 15K rows, guild_bank_item 2K rows. > > > > > > And i need i cl

RE: Better that `NOT IN`

2010-01-15 Thread Daevid Vincent
Peter, this only addresses a sub-select scenario, which doesn't surprise me it would be slow. How does IN() fare if you populate it with the ID's directly? For example: IN(1,3,6,8,19,45,54...) ? In the example, on the web page, we could have run this as two separate queries. One for the 'inner' se

RE: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2010-01-15 Thread Jerry Schwartz
>Dear Jerry, > >OH >32 Bit php is good for working with 64 Bit MySQL ? > [JS] Yes, it's fine. Remember, MySQL is a server - it doesn't care who is on the other end, so long as the queries are properly formed. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farming

Re: Performance of MySQL IN() given a list of constants.

2010-01-15 Thread kabel
On Friday 15 January 2010 13:55:18 fsb wrote: > the example you gave would work with a range constraint: > > WHERE `bar_id` > 0 AND `bar_id` < 63 > > but i guess this is not a general solution. > > i've done exactly this kind of select using an IN constraint very often. > i've not had any trou

Re: Performance of MySQL IN() given a list of constants.

2010-01-15 Thread fsb
the example you gave would work with a range constraint: WHERE `bar_id` > 0 AND `bar_id` < 63 but i guess this is not a general solution. i've done exactly this kind of select using an IN constraint very often. i've not had any trouble with lists of a few hundred so long as i have the necessar

Re: Render row without duplicates

2010-01-15 Thread bharani kumar
select id,cHospital from med_patient where cHospital is not null union select id,cHospital1 from med_patient where cHospital1 is not null union select id,cHospital2 from med_patient where cHospital2 is not null order by 1 throwing error like *Notice*: Undefined index: cHos

Re: tmp tables

2010-01-15 Thread Victor Subervi
On Thu, Jan 14, 2010 at 1:35 AM, Chris W <4rfv...@cox.net> wrote: > I think the reason the other poster was so harsh is because others have > suggested the right way to do it, if not in a lot of detail, and you have > just argued with them. > I don't recall anyone doing that. I don't recall argui

Performance of MySQL IN() given a list of constants.

2010-01-15 Thread kabel
I'm facing a refactor of some slow code that engages the DB pretty heavily. We're looking for a way to load arbitrary sets of rows from a table using an indexed column of decently high cardinality, and I'm not sure if IN() is a good way to do it or not. Basically, we're looking at this: CRE

Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2010-01-15 Thread Edward S.P. Leong
Jerry Schwartz wrote: From: Edward S.P. Leong [mailto:edward...@ita.org.mo] Sent: Friday, January 15, 2010 8:03 AM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance Jerry Schwartz wrote: BTW, would you mind to

RE: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2010-01-15 Thread Jerry Schwartz
From: Edward S.P. Leong [mailto:edward...@ita.org.mo] Sent: Friday, January 15, 2010 8:03 AM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance Jerry Schwartz wrote: BTW, would you mind to tell me which newer versi

Re: Better that `NOT IN`

2010-01-15 Thread fsb
On 1/15/10 12:01 AM, "Junior Ortis" wrote: > Hi guys i have a problem, 3 big tables: item_instance about 15KK rows, > character_inventory 15KK rows, guild_bank_item 2KK rows. > > And i need i clean on item_instance how this query: > > DELETE FROM `item_instance` WHERE guid NOT IN(SELECT item FR

Re: When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-15 Thread Perrin Harkins
On Fri, Jan 15, 2010 at 2:54 AM, Johan Machielse wrote: > The problem is that multiple users can read and update the same field > simultaneously (worse case) which could lead to unpredictable problems. There are other ways to do handle most cases. For example: UPDATE table SET value = value + 1

Re: 32bit ( php + mysql server ) on 64bit Windows 2003 Server performance

2010-01-15 Thread Edward S.P. Leong
Jerry Schwartz wrote: >>BTW, would you mind to tell me which newer version of php and mysql are >>you running now ? >>Due to I want to download a version of them and do the test under win2003... >>Then, I want to tell(reply) you the result(stable)! >> >> >[JS] PHP 5.2.10, Apache 2.2.14 (Win32)

Re: Replications oddity.

2010-01-15 Thread Brent Clark
On 15/01/2010 11:54, Krishna Chandra Prajapati wrote: Hi Brent, I believe you missed log_slave_updates component on 2 and 1. You have to enable binary logs + log_slave_updates on 2 and 1. http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_log-slave-updates Th

Re: Replications oddity.

2010-01-15 Thread Krishna Chandra Prajapati
Hi Brent, I believe you missed log_slave_updates component on 2 and 1. You have to enable binary logs + log_slave_updates on 2 and 1. http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_log-slave-updates Thanks, Krishna On Fri, Jan 15, 2010 at 3:07 PM, Brent Clar

Replications oddity.

2010-01-15 Thread Brent Clark
Hiya I have four servers. 1 < - > 2 || 4 5 I have master - master replication working flawlessly between server id 1 and 2. Server id 4 is a slave of 1. Server id 2 is a slave of 2. For the slaves replications it works great, but ... I just realised ... if I cr