Re: 4 minute slow on select count(*) from table - myisam type

2011-10-07 Thread Johan De Meersman
Good to see the issue has been solved. What I noticed in the mysqltuner output, is that you may want to enlarge your table_cache and open files limit before you run into problems there. - Original Message - > From: "Johnny Withers" > > I haven't used MYISAM in a long time, so i'm not s

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
Glad you got to the bottom of it Joey. On 7 Oct 2011 01:23, "Joey L" wrote: > Guys - I wanted to thank you all very much for your help > I found the offending code on the website ! > thank you very very very much... > what did it for me was a combination of show processlist and show full >

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
Guys - I wanted to thank you all very much for your help I found the offending code on the website ! thank you very very very much... what did it for me was a combination of show processlist and show full processlist. I saw the full queries and the main thing was that it was doing a query

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Jan Steinman
> From: Joey L > > i did google search - myisam is faster...i am not really doing any > transaction stuff. That's true for read-only. But if you have a mix of reads and writes, MYISAM locks tables during writes, which could be blocking reads. In a museum in Havana, there are t

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
I've sent this email a few times now, mysql list kept rejecting it due to size, sorry for any duplicates I think you need to examine this query in particular: | 2567 | p_092211 | localhost | p_092211 | Query | 11 | Sending data | select oldurl, newurl, id, dateadd from w6h8a_sh404sef_ur

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
p_092211 | Query |7 | Locked | INSERT INTO `w6h8a_sh404sef_urls` (`cpt`, `rank`, `oldurl`, `newurl`, `dateadd`) VALUES (1, 0, '2O1/ | +--+--+---+--+-+--+--+----

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
wrote: > Okay, lets hold on for a minute here and go back. We're side tracking too > much. > > Lets state the facts here: > > 1) MyISAM stores the row count internally, a 'select count(*) from table' > DOES NOT DO A FULL TABLE SCAN > 2) hell, a software

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Michael Dykman
I am curious.. Are you the only client on this database or or there other connections doing work in the background? A busy insert/update heavy application could cause these effects. - michael dykman On Thu, Oct 6, 2011 at 12:35 PM, Joey L wrote: > i did google search - myisam is faster...i a

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
i did google search - myisam is faster...i am not really doing any transaction stuff. thanks On Thu, Oct 6, 2011 at 12:16 PM, Andrew Moore wrote: > Sorry, hit send by accident there! *face palm* > Just had a quick scan of the report. You've got 2 1GB disks in software raid > - RAID1 or RAID5? I c

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
Sorry, hit send by accident there! *face palm* Just had a quick scan of the report. You've got 2 1GB disks in software raid - RAID1 or RAID5? I can also see you're creating a lot of temporary files on disk. I think in your previous email that your biggest table's index(s) were larger then the keyb

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Andrew Moore
Joey, does your 'large' table get On Thu, Oct 6, 2011 at 3:22 PM, Joey L wrote: > here is mysqlreport --- > > root@rider:~/tmp# ./mysqlreport --user root --password barakobomb > Use of uninitialized value $is in multiplication (*) at ./mysqlreport

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
here is mysqlreport --- root@rider:~/tmp# ./mysqlreport --user root --password barakobomb Use of uninitialized value $is in multiplication (*) at ./mysqlreport line 829. Use of uninitialized value in formline at ./mysqlreport line 1227. MySQL 5.1.49-

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Rik Wasmus
> thanks for the response - but do not believe queries are the issue > because - Like I said - i have other websites doing the same exact > queries as I am doing on the site with the 9gig table. Contrary to popular believe, size DOES matter... And having a table large enough so it doesn't fit in

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johan De Meersman
I keep finding it extremely peculiar that a count(*) on a MyISAM table would take that long. InnoDB needs to effectively *count* the records, but MyISAM keeps accurate statistics and can just read it from the metadata. This suggests to me that not all your metadata (ie., table descriptors et al)

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
ou may need to change. >>>> #server-id = 1 >>>> #log_bin= /var/log/mysql/mysql-bin.log >>>> expire_logs_days= 10 >>>> max_binlog_size = 100M >>>> #binlog_do_db = include_database_nam

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
e >>> # >>> # * InnoDB >>> # >>> # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. >>> # Read the manual for more InnoDB related options. There are many! >>> # >>> # * Security Features >>> # >>> # Read t

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Johnny Withers
DB related options. There are many! >> # >> # * Security Features >> # >> # Read the manual, too, if you want chroot! >> # chroot = /var/lib/mysql/ >> # >> # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". >> # >&g

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
but no tab completition > > [isamchk] > key_buffer              = 16M > > # > # * IMPORTANT: Additional settings that can override those from this file! > #   The files must end with '.cnf', otherwise they'll be ignored. > # > !includedir /etc/mysql/conf

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-06 Thread Joey L
rwise they'll be ignored. # !includedir /etc/mysql/conf.d/ any thoughts or help would be appricated. thanks On Mon, Oct 3, 2011 at 1:22 PM, Eric Bergen wrote: > Can you run show processlist in another connection while the select > count(*) query is running and say what the state column i

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Eric Bergen
Can you run show processlist in another connection while the select count(*) query is running and say what the state column is? On Mon, Oct 3, 2011 at 7:00 AM, Joey L wrote: > this is not a real query on the site - it is just a way i am measuring > performance on mysql - I do not know if

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Joey L
:58 AM, Andrés Tello wrote: > have you tried > > select count(yourindex) instead of select count(*) ? > > > On Mon, Oct 3, 2011 at 7:53 AM, Joey L wrote: > >> Thanks for the input - >> 1. I will wait 48 hours and see what happens. >> 2. can you tell me what

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Andrés Tello
have you tried select count(yourindex) instead of select count(*) ? On Mon, Oct 3, 2011 at 7:53 AM, Joey L wrote: > Thanks for the input - > 1. I will wait 48 hours and see what happens. > 2. can you tell me what are some performance tests I can do to help me > better tune my ser

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-03 Thread Joey L
Thanks for the input - 1. I will wait 48 hours and see what happens. 2. can you tell me what are some performance tests I can do to help me better tune my server ? 3. I am concerned about this table : | w6h8a_sh404sef_urls | MyISAM | 10 | Dynamic| 8908402 |174 |

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Bruce Ferrell
The meaning is: increase max_connections reduce wait_timeout -- 28800 is wait 8 hours before closing out dead connections same for interactive_timeout increase key_buffer_size (> 7.8G) increase join_buffer_size -- This keeps mysql from having to run to disk constantly for keys -- Key buffer siz

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
t;<" -- does > this mean I have to set it lower ?? > thanks...here is the info below you both asked for : > > > mysql> select count(*) from w6h8a_sh404sef_urls ; > > +--+ > | count(*) | > +--+ > | 8908193 | > +--+ > 1 row in

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
The section called: Variables to adjust: --when it says ">" -- does this mean I have to set it higher in my.cnf file ?? and if I have a "<" -- does this mean I have to set it lower ?? thanks...here is the info below you both asked for : mysql> select coun

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Andrew Moore
0.0 0:00.04 [migration/0] >>4 root 20 0 000 S0 0.0 0:00.16 [ksoftirqd/0] >> >> >> On Sun, Oct 2, 2011 at 9:55 AM, Andrew Moore wrote: >> >> > Is your table MyISAM or InnoDB? >> > >> > A >> > >> >

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Bruce Ferrell
I'd suggest mysqltuner. You can get it by using: wget http://mysqltuner.pl See what suggestions that makes On 10/02/2011 06:44 AM, Joey L wrote: > I have having issues with mysql db - I am doing a "select count(*) from > table" -- and it take 3 to 4 min. > My t

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
> On Sun, Oct 2, 2011 at 2:44 PM, Joey L wrote: > >> I have having issues with mysql db - I am doing a "select count(*) from >> table" -- and it take 3 to 4 min. >> My table has about 9,000,000 records in it. >> I have noticed issues on my web pages so that is

Re: 4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Andrew Moore
Is your table MyISAM or InnoDB? A On Sun, Oct 2, 2011 at 2:44 PM, Joey L wrote: > I have having issues with mysql db - I am doing a "select count(*) from > table" -- and it take 3 to 4 min. > My table has about 9,000,000 records in it. > I have noticed issues on my web

4 minute slow on select count(*) from table - myisam type

2011-10-02 Thread Joey L
I have having issues with mysql db - I am doing a "select count(*) from table" -- and it take 3 to 4 min. My table has about 9,000,000 records in it. I have noticed issues on my web pages so that is why i did this test. I have about 4 gig of memory on the server. Is there anything I can

Re: Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-10 Thread Andrés Tello
As usual, after you send a mail, you check for other things >From the 32GB of ram, I only was allocating 2G, not by the process, but by all the S.O... free -G reported barely 1 gig of ram... XD -> happy face that I have lots of ram... now my face is like: ¬¬ -> why I didn't verfy the amount

Re: Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-10 Thread Rob Wultsch
On Fri, Jul 9, 2010 at 9:09 PM, Andrés Tello wrote: > Hi, I'm using mysql 4.1.21, a legacy system. Next step to migrate it, but > for now, I need the community help. > > I have a 23GB table, if I do a select count(over_an_index) from table it > uses 1.4minutes to read. The mai

Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-09 Thread Andrés Tello
Hi, I'm using mysql 4.1.21, a legacy system. Next step to migrate it, but for now, I need the community help. I have a 23GB table, if I do a select count(over_an_index) from table it uses 1.4minutes to read. The main issue is that this table is the main table of a system and each query is t

Re: select count(). Help-a-newb

2008-04-09 Thread contiw
> -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/select-count%28%29.-Help-a-newb-tp16582786p16590541.html Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: select count(). Help-a-newb

2008-04-09 Thread Richard
Hi I think you would do this : SELECT sf_conferences.id, sf_conferences.name, count(*) AS `count` FROM (( LEFT JOIN sf_forums ON sf_conferences.id=sf_forums.conferenceidfk) LEFT sf_threads ON sf_forums.id = sf_threads.forumidfk) LEFT JOIN sf_messages ON sf_threads.id = sf_messages.threadidfk GROU

select count(). Help-a-newb

2008-04-09 Thread contiw
rums ON sf_conferences.id=sf_forums.conferenceidfk) left JOIN sf_threads ON sf_forums.id = sf_threads.forumidfk) left JOIN sf_messages ON sf_threads.id = sf_messages.threadidfk GROUP BY sf_conferences.id, sf_conferences.name -- View this message in context: http://www.nabble.com/select-count%28%29.-Help-a-newb-tp16

Re: group a select * and a select COUNT from 2 different [... ] (solved thankyou !)

2008-02-20 Thread Richard
ELECT a.username, a.first_name, a.last_name,b.(SELECT COUNT(*) AS count >FROM login_table b WHERE a.username = b.username) FROM user_list a Try ... SELECT a.username, a.first_name, a.last_name,COUNT(b.username) AS count FROM user_list a JOIN login_table b ON a.username = b.username GROUP BY a.us

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread Peter Brawley
It doesn't count if it is 0 it's not on the liste and if the user has logged in more than once the result is 1 (because of the group by ...). Thankyou Peter Brawley a écrit : Richard, >Can I do something like this : >SELECT a.username, a.first_name, a.last_name,b.(SEL

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread David Schneider-Joseph
Any idea how to do this? Thanks :) Peter Brawley a écrit : Richard, >Can I do something like this : >SELECT a.username, a.first_name, a.last_name,b.(SELECT COUNT(*) AS count >FROM login_table b WHERE a.username = b.username) FROM user_list a Try ... SELECT a.username, a.first_name, a.l

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread ddevaudreuil
ect Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ? Sorry it's me again, I made a mistake, it counts the number of logins correctly, but does not show members with 0 logins ! Any idea how to do th

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread ddevaudreuil
PM To [EMAIL PROTECTED], mysql@lists.mysql.com cc Subject Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ? Sorry it's me again, I made a mistake, it counts the number of logins correctly, but does not s

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread Richard
Sorry it's me again, I made a mistake, it counts the number of logins correctly, but does not show members with 0 logins ! Any idea how to do this? Thanks :) Peter Brawley a écrit : Richard, >Can I do something like this : >SELECT a.username, a.first_name, a.last_name,b.(S

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread Richard
once the result is 1 (because of the group by ...). Thankyou Peter Brawley a écrit : Richard, >Can I do something like this : >SELECT a.username, a.first_name, a.last_name,b.(SELECT COUNT(*) AS count >FROM login_table b WHERE a.username = b.username) FROM user_list a Try ... SE

Re: group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread Peter Brawley
Richard, >Can I do something like this : >SELECT a.username, a.first_name, a.last_name,b.(SELECT COUNT(*) AS count >FROM login_table b WHERE a.username = b.username) FROM user_list a Try ... SELECT a.username, a.first_name, a.last_name,COUNT(b.username) AS count FROM user_li

group a select * and a select COUNT from 2 different tables using result of first table to do the COUNT ... is it possible ?

2008-02-19 Thread Richard
in. So to get the list of users I would do : SELECT username, first_name, last_name FROM user_list And to count the number of connections I would do SELECT COUNT(*) AS count FROM login_table WHERE username = $result['username'] Can I do something like this : SELECT a.username, a.

Re: Applying LIMIT to SELECT count(*)

2007-12-21 Thread js
> View this message in context: > http://www.nabble.com/Applying-LIMIT-to-SELECT-count%28*%29-tp14453544p14459808.html > > Sent from the MySQL - General mailing list archive at Nabble.com. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com

Re: Applying LIMIT to SELECT count(*)

2007-12-21 Thread Urms
The problem is that there are certain conditions after WHERE different for each query and the results number can be very different. -- View this message in context: http://www.nabble.com/Applying-LIMIT-to-SELECT-count%28*%29-tp14453544p14459808.html Sent from the MySQL - General mailing list

Re: Applying LIMIT to SELECT count(*)

2007-12-21 Thread js
isfy certain conditions. I join two tables using WHERE and there are > millions of records as the result. When I do SELECT count(*) it takes > really too long. The table has appropriate indexes and I experimented with > replacing the conditions, etc., so I don't think there is a

Applying LIMIT to SELECT count(*)

2007-12-21 Thread Urms
Hi, My task is to limit calculation of total number of items in the database that satisfy certain conditions. I join two tables using WHERE and there are millions of records as the result. When I do SELECT count(*) it takes really too long. The table has appropriate indexes and I

Re: Why would a SELECT COUNT(*)... WHERE... take way way longer than SELECT COUNT(primary_key)... WHERE... ?

2006-06-19 Thread cvizitiu
Alex Arul wrote: count(*) is slow in innodb due to Multi Versioning. Which table type are you using ? Hi Alex, Thanks for answering; All tables are MyISAMs. I'm beginning to wonder if I am not taxed heavily for using floats for the geographic coordinates. -- MySQL General Mailing List F

Re: Why would a SELECT COUNT(*)... WHERE... take way way longer than SELECT COUNT(primary_key)... WHERE... ?

2006-06-17 Thread Jad madi
t one point I had to issue the following query on a 1.8GB 42mil > > records table: > > > > SELECT COUNT(*) FROM geoRecord WHERE geoRecord.geolatitude IS NOT NULL ; > > > > As it took forever to complete (I mean more than 20 minutes) I've > > stopped the

Re: Why would a SELECT COUNT(*)... WHERE... take way way longer than SELECT COUNT(primary_key)... WHERE... ?

2006-06-17 Thread Alex Arul
y on a 1.8GB 42mil records table: SELECT COUNT(*) FROM geoRecord WHERE geoRecord.geolatitude IS NOT NULL ; As it took forever to complete (I mean more than 20 minutes) I've stopped the client and attempted to work around. The table looks like this: EXPLAI

Why would a SELECT COUNT(*)... WHERE... take way way longer than SELECT COUNT(primary_key)... WHERE... ?

2006-06-09 Thread cvizitiu
Hi everybody, MySQL 5.0.21 running on RedHat EL4, 2GHz CPU, 2,5GB RAM, RAID5/128MB RAM. At one point I had to issue the following query on a 1.8GB 42mil records table: SELECT COUNT(*) FROM geoRecord WHERE geoRecord.geolatitude IS NOT NULL ; As it took forever to complete (I mean more than

Re: simpe select count question

2006-04-20 Thread Dan Buettner
---+---+ | pending| 2 | | processing | 1 | | shipped| 0 | ++---+ 3 rows in set (0.00 sec) Dan Hello, I would like merge this 3 query into a single one... SELECT COUNT(*) AS count FROM orders WHERE order_status = 'pending', SELECT COUNT(*) AS count F

simpe select count question

2006-04-20 Thread Andras Kende
Hello, I would like merge this 3 query into a single one... SELECT COUNT(*) AS count FROM orders WHERE order_status = 'pending', SELECT COUNT(*) AS count FROM orders WHERE order_status = 'processing', SELECT COUNT(*) AS count FROM orders WHERE order_status = 'shippe

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-14 Thread Rhino
COUNT(*) result faster? Rhino - Original Message - From: "sheeri kritzer" <[EMAIL PROTECTED]> To: "Kevin Burton" <[EMAIL PROTECTED]> Cc: Sent: Monday, November 14, 2005 5:10 PM Subject: Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB? H

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-14 Thread sheeri kritzer
MySQL 5.0. -Sheeri On 11/1/05, Kevin Burton <[EMAIL PROTECTED]> wrote: > MyISAM has a cool feature where it keeps track of the internal row > count so that > > SELECT COUNT(*) FROM FOO executes in constant time. Usually 1ms or so. > > The same query on INNODB is O(logN) si

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-04 Thread Jigal van Hemert
[EMAIL PROTECTED] wrote: Jigal van Hemert <[EMAIL PROTECTED]> wrote on 11/02/2005 03:29:14 AM: > If I understand > http://dev.mysql.com/doc/refman/5.0/en/table-and-index.html > correctly, the index of the primary key is stored as the clustered index > together with the data. To me this means

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-02 Thread Heikki Tuuri
Sent: Wednesday, November 02, 2005 10:30 AM Subject: Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB? Shankar Unni wrote: [EMAIL PROTECTED] wrote: If I understand the InnoDB engine correctly, I don't see how they could speed it up unless they start tracking how many records

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-02 Thread SGreen
Jigal van Hemert <[EMAIL PROTECTED]> wrote on 11/02/2005 03:29:14 AM: > Shankar Unni wrote: > > [EMAIL PROTECTED] wrote: > > > >> If I understand the InnoDB engine correctly, I don't see how they > >> could speed it up unless they start tracking how many records belong > >> to each active "vers

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-02 Thread Jigal van Hemert
Shankar Unni wrote: [EMAIL PROTECTED] wrote: If I understand the InnoDB engine correctly, I don't see how they could speed it up unless they start tracking how many records belong to each active "version" within a database. But one thing you can do to speed it up somewhat is to do a COUNT

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread Shankar Unni
[EMAIL PROTECTED] wrote: If I understand the InnoDB engine correctly, I don't see how they could speed it up unless they start tracking how many records belong to each active "version" within a database. But one thing you can do to speed it up somewhat is to do a COUNT(PK_column) (rather th

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread Kevin Burton
Are you sure? Finding a single record using an index may be O(logN), but wouldn't reading all of the index be O(N)? Yeah.. you're right. It would be O(N)... I was thinking this as I hit the "send" button :) Kevin Kevin A. Burton, Location - San Francisco, CA AIM/YIM - sfburtonator,

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread Jochem van Dieten
On 11/1/05, Kevin Burton wrote: > MyISAM has a cool feature where it keeps track of the internal row > count so that > > SELECT COUNT(*) FROM FOO executes in constant time. Usually 1ms or so. > > The same query on INNODB is O(logN) since it uses the btree to > satisfy the

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread SGreen
Kevin Burton <[EMAIL PROTECTED]> wrote on 11/01/2005 03:39:59 PM: > MyISAM has a cool feature where it keeps track of the internal row > count so that > > SELECT COUNT(*) FROM FOO executes in constant time. Usually 1ms or so. > > The same query on INNODB is O(logN) si

Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread Paul DuBois
At 12:39 -0800 11/1/05, Kevin Burton wrote: MyISAM has a cool feature where it keeps track of the internal row count so that SELECT COUNT(*) FROM FOO executes in constant time. Usually 1ms or so. The same query on INNODB is O(logN) since it uses the btree to satisfy the query. I believe

Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?

2005-11-01 Thread Kevin Burton
MyISAM has a cool feature where it keeps track of the internal row count so that SELECT COUNT(*) FROM FOO executes in constant time. Usually 1ms or so. The same query on INNODB is O(logN) since it uses the btree to satisfy the query. I believe that MyISAM just increments an internal

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Mathias
r IN the data > dictionary that represents "row count". Unless a separate dictionary is > maintained FOR EACH TRANSACTION, the record counts will be wrong. The > record counts determined by SELECT COUNT(*) are *per transaction* so the > only way to do a record count is by check

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread SGreen
EACH TRANSACTION, the record counts will be wrong. The record counts determined by SELECT COUNT(*) are *per transaction* so the only way to do a record count is by checking each row (pending or not) against cross-transaction isolation. This has everything to do with the row-level locking built into

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Mathias
Selon [EMAIL PROTECTED]: > Mathias <[EMAIL PROTECTED]> wrote on 06/28/2005 06:13:08 AM: > > > Selon Behrang Saeedzadeh <[EMAIL PROTECTED]>: > > > > > Mathias, > > > > > > Thanks a lot! > > > > > > > I will not explain the same thing for sqlserver, sybase ..., but > when > > > > your RDBMs > > > >

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread SGreen
Mathias <[EMAIL PROTECTED]> wrote on 06/28/2005 06:13:08 AM: > Selon Behrang Saeedzadeh <[EMAIL PROTECTED]>: > > > Mathias, > > > > Thanks a lot! > > > > > I will not explain the same thing for sqlserver, sybase ..., but when > > > your RDBMs > > > have a data dictionnary, you don't need to exec

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Mathias
Selon Behrang Saeedzadeh <[EMAIL PROTECTED]>: > Mathias, > > Thanks a lot! > > > I will not explain the same thing for sqlserver, sybase ..., but when > > your RDBMs > > have a data dictionnary, you don't need to execute count(*) :o) WITH > > Updated > > statistics of course. > > I'm a little bit

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Behrang Saeedzadeh
Mathias, Thanks a lot! I will not explain the same thing for sqlserver, sybase ..., but when your RDBMs have a data dictionnary, you don't need to execute count(*) :o) WITH Updated statistics of course. I'm a little bit confused here. Why the count(*) is not transformed to a select from

Re: A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Mathias
> -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > Hi Behrang, ORACLE : ****** There are t

A question about the select count(*) performance and the InnoDB engine

2005-06-28 Thread Behrang Saeedzadeh
Hi all I was reading the High Performance MySQL book (by O'Reilly) and there was mentioned that executing a count(*) is slower on the InnoDB engine compared to the MyISAM engine, because InnoDB tables do not keep track of the number of the records. I just wanted to know that if this performance d

Re: select count(*) table

2005-05-16 Thread Seena Blace
just give a it try select count(columnname) from table; Eric Bergen <[EMAIL PROTECTED]> wrote:select count(*) table; gives me a syntax error in 4.0 and 4.1 so I'm not sure how that worked. Something similar would be select count(*) t; which uses the shortcut alias syntax. It&#x

Re: select count(*) table

2005-05-16 Thread Eric Bergen
select count(*) table; gives me a syntax error in 4.0 and 4.1 so I'm not sure how that worked. Something similar would be select count(*) t; which uses the shortcut alias syntax. It's the same as doing select count(*) as t; Simon Garner wrote: [EMAIL PROTECTED] wrote: I have

Re: select count(*) table

2005-05-13 Thread Simon Garner
[EMAIL PROTECTED] wrote: I have a curious situation I was hoping someone could shed some light on. mysql> select count(*) table; +---+ | table | +---+ | 0 | +---+ 1 row in set (0.00 sec) mysql> select count(*) from table; +--+ | count(*) | +--+ |

select count(*) table

2005-05-13 Thread [EMAIL PROTECTED]
I have a curious situation I was hoping someone could shed some light on. mysql> select count(*) table; +---+ | table | +---+ | 0 | +---+ 1 row in set (0.00 sec) mysql> select count(*) from table; +--+ | count(*) | +--+ |25965 | +--+ 1 row in set

RE: select & count

2005-01-13 Thread Dave Merrill
group by version returns value and count columns, one row for each value counted.) I'd conclude that the group by version is faster, and also that you ought to test your own data (:-). Here are the two queries I used: SELECT (SELECT count(*) FROM patients WHERE last

Re: select & count

2005-01-13 Thread beacker
> I have table account (see below). I need to get count of received, > count of send and cound of cancelled records. I know that I can do > this in 3 queries. > #1. select count(*) from account where status='received'; > #2. select count(*) from account where status=&

Re: select & count

2005-01-13 Thread Michael Stassen
Ian Sales wrote: - I always concatenate the wanted criteria (status, in this case) with a unique ID field in order to be absolutely certain I'm counting every instance of each value of status. I've not investigated to see whether I *really* need to do this, but it feels safer... - ian Then that

RE: select & count

2005-01-13 Thread Jay Blanchard
[snip] What is the purpose of DISTINCT here? [/snip] It's a hold over from other RDBMSs that I have worked with in the past. The syntax is still valid and I pretty much automatically type it. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http:/

Re: select & count

2005-01-13 Thread Michael Stassen
Jay Blanchard wrote: [snip] I have table account (see below). I need to get count of received, count of send and cound of cancelled records. I know that I can do this in 3 queries. #1. select count(*) from account where status='received'; #2. select count(*) from account where status=

Re: select & count

2005-01-13 Thread Ian Sales
[EMAIL PROTECTED] wrote: I would think that the Jan solution should execute in a single pass through the table. The Dave (subquery) version will probably need to make 3 passes through the table get the same results. - er, it's Ian, not Jan :-) As was mentioned in another response, the inequalit

RE: select & count

2005-01-13 Thread Jay Blanchard
[snip] What is the difference between '='' and '<>'? [/snip] = EQUAL TO <> NOT EQUAL TO -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: select & count

2005-01-13 Thread Jerry Swanson
d) LIKE 'cancelled%',1,0)) as cancelled > > FROM > > account > > GROUP BY date; > > > > > > On Wed, 12 Jan 2005 22:51:00 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > > > > I have table account (see below). I need to get count

Re: select & count

2005-01-13 Thread SGreen
s,id) LIKE 'cancelled%',1,0)) as cancelled > FROM > account > GROUP BY date; > > > On Wed, 12 Jan 2005 22:51:00 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > > > I have table account (see below). I need to get count of received, > > >

RE: select & count

2005-01-13 Thread Dave Merrill
Jan 2005 22:51:00 -0500, Dave Merrill wrote: > > > I have table account (see below). I need to get count of received, > > > count of send and cound of cancelled records. I know that I can do > > > this in 3 queries. > > > #1. select count(*) from ac

RE: select & count

2005-01-13 Thread Jay Blanchard
[snip] What query suppose to be faster? Jan or Dave? [/snip] Queries using equalities are generally faster than LIKE. YMMV. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: select & count

2005-01-13 Thread Jay Blanchard
[snip] This is what I was looking for. Why the query is call cross-tab? [/snip] It is called a crosstab because of the way the reults resemble a results table. Here is an article that shows the crosstab in larger use http://www.evolt.org/article/Using_MySQL_and_PHP_to_Present_Excel_Spread sh

Re: select & count

2005-01-13 Thread Jerry Swanson
ROUP BY date; On Wed, 12 Jan 2005 22:51:00 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > > I have table account (see below). I need to get count of received, > > count of send and cound of cancelled records. I know that I can do > > this in 3 queries. > > #1. select c

Re: select & count

2005-01-13 Thread Jerry Swanson
ULL|| > >| date | datetime > > | YES | | NULL|| > >+--+--+--+-+-++ > > > > > >I have table account (see below). I need to get count of received, > >count of send and cound of cancelled records. I know that I

RE: select & count

2005-01-13 Thread Jay Blanchard
[snip] I have table account (see below). I need to get count of received, count of send and cound of cancelled records. I know that I can do this in 3 queries. #1. select count(*) from account where status='received'; #2. select count(*) from account where status='send'; #3.

Re: select & count

2005-01-13 Thread Roger Baklund
Jerry Swanson wrote: [...] I need to get count of received, count of send and cound of cancelled records. I know that I can do this in 3 queries. #1. select count(*) from account where status='received'; #2. select count(*) from account where status='send'; #3. select count(*

RE: select & count

2005-01-12 Thread Dave Merrill
> I have table account (see below). I need to get count of received, > count of send and cound of cancelled records. I know that I can do > this in 3 queries. > #1. select count(*) from account where status='received'; > #2. select count(*) from account where status=&

Re: select & count

2005-01-12 Thread Ryan Yagatich
Jerry, You could also have 3 rows returned by running the following: select count(*) from account where status in ('received','send','canceled') group by status ; This will return 3 rows, similar to the following +-+-

Re: select & count

2005-01-12 Thread Ian Sales
| YES | | NULL|| +--+--+--+-+-++ I have table account (see below). I need to get count of received, count of send and cound of cancelled records. I know that I can do this in 3 queries. #1. select count(*) from account where status='received'; #2. select count(*) from accou

select & count

2005-01-12 Thread Jerry Swanson
| YES | | NULL|| +--+--+--+-+-++ I have table account (see below). I need to get count of received, count of send and cound of cancelled records. I know that I can do this in 3 queries. #1. select count(*) from account where status='received'; #2. select count(*) from account where status=

  1   2   >