Spatial functions

2014-02-09 Thread Lay András
Hi! Can i use MySQL spatial functions directly, to compute distance between two GPS coordinate pairs in WGS84 format? Thank you! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql

Re: Slow query using string functions

2010-05-27 Thread Joerg Bruehe
BY feed_new.new_title; [[...]] The query is doing a scan of the 9816 records that have pub_id = @PUBID, but even so this seems like a long time. Are the built-in string functions really that slow? The general rule is: If you are not taking the value of a column directly but are applying any function

Re: Slow query using string functions

2010-05-27 Thread Baron Schwartz
Jerry, On Wed, May 26, 2010 at 5:13 PM, Jerry Schwartz je...@gii.co.jp wrote: I have a pretty simple query that seems to take a lot longer than it ought to (over 2 minutes). I suspect that if you watch Handler_ stats, you'll find that the EXPLAIN estimate is wrong for some reason and it's

RE: Slow query using string functions

2010-05-27 Thread Jerry Schwartz
-Original Message- From: Gavin Towey [mailto:gto...@ffn.com] Sent: Wednesday, May 26, 2010 7:39 PM To: je...@gii.co.jp; mysql@lists.mysql.com Subject: RE: Slow query using string functions Jerry, Are you sure this is really your explain plan for this query? That's not at all what I

RE: Slow query using string functions

2010-05-27 Thread Jerry Schwartz
/ FAX: 860.674.8341 www.the-infoshop.com -Original Message- From: baron.schwa...@gmail.com [mailto:baron.schwa...@gmail.com] On Behalf Of Baron Schwartz Sent: Thursday, May 27, 2010 9:09 AM To: MySql Subject: Re: Slow query using string functions Jerry, On Wed, May 26, 2010 at 5:13 PM

Slow query using string functions

2010-05-26 Thread Jerry Schwartz
possible_keys: pub_id,pub_id_2 key: pub_id key_len: 48 ref: const rows: 9816 Extra: Using where The query is doing a scan of the 9816 records that have pub_id = @PUBID, but even so this seems like a long time. Are the built-in string functions really

RE: Slow query using string functions

2010-05-26 Thread Gavin Towey
using string functions I have a pretty simple query that seems to take a lot longer than it ought to (over 2 minutes). Table `feed_new` has a single VARCHAR(255) column, `new_title`, that is an index. Table `prod` has many fields: `prod_title` and `pub_id` are both indexes (VARCHAR). `feed_new

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-03 Thread Rob Wultsch
On Sat, May 1, 2010 at 11:12 PM, dan d...@tappin.ca wrote: Can any one help me with understanding the mysql spatial functions?  I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing unique boundaries i.e

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-03 Thread dan
: Can any one help me with understanding the mysql spatial functions?  I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing unique boundaries i.e. rectangles and I want to search the table to find

mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
Can any one help me with understanding the mysql spatial functions? I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing unique boundaries i.e. rectangles and I want to search the table to find the rectangle that bounds

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
the mysql spatial functions? I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing unique boundaries i.e. rectangles and I want to search the table to find the rectangle that bounds a specific point. Dan -- MySQL

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread Baron Schwartz
Yu yuzhih...@gmail.com wrote: I think you may have seen this: http://dev.mysql.com/doc/refman/5.0/en/relations-on-geometry-mbr.html On Sat, May 1, 2010 at 11:12 PM, dan d...@tappin.ca wrote: Can any one help me with understanding the mysql spatial functions?  I can only seem to find bits

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
spatial functions?  I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing unique boundaries i.e. rectangles and I want to search the table to find the rectangle that bounds a specific point. Dan -- MySQL General

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
/relations-on-geometry-mbr.html On Sat, May 1, 2010 at 11:12 PM, dan d...@tappin.ca wrote: Can any one help me with understanding the mysql spatial functions? I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data representing

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
-on-geometry-mbr.html On Sat, May 1, 2010 at 11:12 PM, dan d...@tappin.ca wrote: Can any one help me with understanding the mysql spatial functions? I can only seem to find bits and pieces of how-to's etc. I have an existing table of lat / long data

Re: mysql spatial functions (Was: Best index for searching on lat / long data i.e. decimal vs. float)

2010-05-02 Thread dan
seen this: http://dev.mysql.com/doc/refman/5.0/en/relations-on-geometry-mbr.html On Sat, May 1, 2010 at 11:12 PM, dan d...@tappin.ca wrote: Can any one help me with understanding the mysql spatial functions? I can only seem to find bits and pieces of how-to's

MySQL University session on November 19: Memcached Functions for MySQL

2009-11-18 Thread Stefan Hinz
Memcached Functions for MySQL http://forge.mysql.com/wiki/Memcached_Functions_for_MySQL_%28UDFs%29 This Thursday (November 19th, 14:00 UTC), Patrick Galbraith will present memcached Functions for MySQL (UDFs). This session is about a suite of functions available to use with MySQL that allow you

Custom agregate functions

2009-06-30 Thread Dainis Polis
Hi MySQL fans! Is there way to create subj ? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

Re: Custom agregate functions

2009-06-30 Thread Dan Nelson
In the last episode (Jun 30), Dainis Polis said: Hi MySQL fans! Is there way to create subj ? http://dev.mysql.com/doc/refman/5.1/en/adding-functions.html http://dev.mysql.com/doc/refman/5.1/en/adding-udf.html http://dev.mysql.com/doc/refman/5.1/en/udf-aggr-calling.html -- Dan

group by different time period than functions allow

2009-06-11 Thread Andrey Dmitriev
Can someone point a link, or show an example. basically, i have something like select week(mydate), count(mystuff) from table group by week(mydate); however, I need week to start on Wed 9am and end next Wed. What's the easiest way to accomplish that? thanks, andrey -- MySQL General Mailing

RE: group by different time period than functions allow

2009-06-11 Thread Rolando Edwards
by different time period than functions allow Can someone point a link, or show an example. basically, i have something like select week(mydate), count(mystuff) from table group by week(mydate); however, I need week to start on Wed 9am and end next Wed. What's the easiest way to accomplish

RE: group by different time period than functions allow

2009-06-11 Thread Rolando Edwards
[mailto:redwa...@logicworks.net] Sent: Thursday, June 11, 2009 12:34 PM To: Andrey Dmitriev; mysql@lists.mysql.com Subject: RE: group by different time period than functions allow SELECT DT DT1,DATE_ADD(DT,INTERVAL 1 WEEK) DT2 FROM (SELECT DATE_ADD(DATE(DATE_ADD(NOW(),INTERVAL (DOW-DAYOFWEEK(NOW

Re: where is the stored functions STORED?

2009-03-27 Thread Cui Shijun
Hi, Dan Nelson Rolando Edwards It works, thank you. :-) 2009/3/26 Rolando Edwards redwa...@logicworks.net: The table mysql.proc always contains the hard code of stored procedures and functions. Triggers in 5.0 are stored in a .TRG file Make sure, if you used mysqldump, to include

where is the stored functions STORED?

2009-03-26 Thread Cui Shijun
hi, It seems that the stored functions isn't stored in a seperated file like trigger does. Where are them? If I copy the database directory from a server to another, can I get the same functions on the both servers? Thank you. -- MySQL General Mailing List For list archives: http

Re: where is the stored functions STORED?

2009-03-26 Thread Dan Nelson
In the last episode (Mar 26), Cui Shijun said: It seems that the stored functions isn't stored in a seperated file like trigger does. Where are them? If I copy the database directory from a server to another, can I get the same functions on the both servers? They're stored

RE: where is the stored functions STORED?

2009-03-26 Thread Rolando Edwards
The table mysql.proc always contains the hard code of stored procedures and functions. Triggers in 5.0 are stored in a .TRG file Make sure, if you used mysqldump, to include --triggers as a dump option Rolando A. Edwards MySQL DBA (CMDBA) 155 Avenue of the Americas, Fifth Floor New York, NY

RE: Question on default database for stored functions

2008-12-26 Thread Jerry Schwartz
-Original Message- From: blue.trapez...@gmail.com [mailto:blue.trapez...@gmail.com] On Behalf Of Vikram Vaswani Sent: Thursday, December 25, 2008 5:47 AM To: mysql@lists.mysql.com Subject: Question on default database for stored functions Hi According to the MySQL manual, By default

Re: Question on default database for stored functions

2008-12-26 Thread Peter Brawley
...@gmail.com] On Behalf Of Vikram Vaswani Sent: Thursday, December 25, 2008 5:47 AM To: mysql@lists.mysql.com Subject: Question on default database for stored functions Hi According to the MySQL manual, By default, a routine is associated with the default database.When the routine is invoked

Question on default database for stored functions

2008-12-25 Thread Vikram Vaswani
Hi According to the MySQL manual, By default, a routine is associated with the default database.When the routine is invoked, an implicit USE db_name is performed (and undone when the routine terminates) However, when I tried accessing a stored routine from another database, I received an

How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
I may be approaching this all wrong, but I need to know a percentage of total sales within a select statement. So I can do something like this: Select company, state, sales, sum(sales) / sales as percent From Sales Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network EngineerSafe Data,

Re: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Ananda Kumar
yes, u can use the below sql. regards anandkl On 7/25/08, David Ruggles [EMAIL PROTECTED] wrote: I may be approaching this all wrong, but I need to know a percentage of total sales within a select statement. So I can do something like this: Select company, state, sales, sum(sales) / sales

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
: Ananda Kumar [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 10:37 AM To: David Ruggles Cc: mysql Subject: Re: How do I (can I) use aggregate functions inside a select yes, u can use the below sql. regards anandkl On 7/25/08, David Ruggles [EMAIL PROTECTED] wrote: I may be approaching

Re: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread walter harms
David Ruggles wrote: I may be approaching this all wrong, but I need to know a percentage of total sales within a select statement. So I can do something like this: Select company, state, sales, sum(sales) / sales as percent From Sales mmh, you want sum(sales where

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Ian Simpson
[EMAIL PROTECTED] -Original Message- From: Ananda Kumar [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 10:37 AM To: David Ruggles Cc: mysql Subject: Re: How do I (can I) use aggregate functions inside a select yes, u can use the below sql. regards anandkl

RE: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Jerry Schwartz
-Original Message- From: David Ruggles [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 10:53 AM To: 'mysql' Subject: RE: How do I (can I) use aggregate functions inside a select I get: Error Code : 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns

FW: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread David Ruggles
PROTECTED] -Original Message- From: Ian Simpson [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 11:15 AM To: David Ruggles Cc: 'mysql' Subject: RE: How do I (can I) use aggregate functions inside a select Hi David, Try Select company, state, sales, sum(sales) / sales as percent From

Re: FW: How do I (can I) use aggregate functions inside a select

2008-07-25 Thread Mr. Shawn H. Corey
Why? Because it's Friday and I'm feeling silly :) mysql SELECT * FROM sales; +--+---++ | company | state | sales | +--+---++ | ABC | AZ| 140.01 | | XYZ | AZ| 17.76 | | ABC | NY| 123.45 | | XYZ

Re: Using Date Functions in Where Clause

2008-04-19 Thread Baron Schwartz
Hi, On Mon, Apr 14, 2008 at 1:54 PM, Jamie Madill [EMAIL PROTECTED] wrote: Hello, Basically I want to know if this is a good query for indexing. I have the following query: select count(1) as count from session where last = DATE_SUB(NOW(), INTERVAL :from SECOND) Is it

Using Date Functions in Where Clause

2008-04-14 Thread Jamie Madill
Hello, Basically I want to know if this is a good query for indexing. I have the following query: select count(1) as count from session where last = DATE_SUB(NOW(), INTERVAL :from SECOND) Is it safe to assume that the expression calling the function DATE_SUB is evaluated just once to a

MYSQL FUNCTIONS

2008-03-10 Thread Krishna Chandra Prajapati
Hi All, While i was going through mysql reference manual. I saw that A query cannot be cached if it contains any of the functions shown below BENCHMARK() CONNECTION_ID() CONVERT_TZ() CURDATE() CURRENT_DATE() CURRENT_TIME

Re: MYSQL FUNCTIONS

2008-03-10 Thread Sebastian Mendel
Krishna Chandra Prajapati schrieb: Hi All, While i was going through mysql reference manual. I saw that A query cannot be cached if it contains any of the functions shown below BENCHMARK() CONNECTION_ID() CONVERT_TZ() CURDATE() CURRENT_DATE

Re: MYSQL FUNCTIONS

2008-03-10 Thread Tim McDaniel
On Mon, 10 Mar 2008, Krishna Chandra Prajapati [EMAIL PROTECTED] wrote: While i was going through mysql reference manual. I saw that A query cannot be cached if it contains any of the functions shown below ... NOW() On my production server, the following query is being used. select * from

Can anybody please let me know the counterpart functions for SetSRID(),Makebox2D(),Distance_Sphere() of PostGIS in MySQL

2008-02-05 Thread ahmadbasha.shaik
Hello I want to use functions - SetSRID(),Makebox2D(),Distance_Sphere() of Post GIS in MySQL. Can please let me know the similar functions in MySQL. Environment === Operating System : Red Hat Linux 3.4 Database : MySQL Version 5.0.51 PostgreSQL 8.2.6 with PostGIS 1.2.1 Functions

indexing tables using my owns functions

2007-11-13 Thread Pau Marc Munoz Torres
Hi I've created a function that return a float value the code for it is : create function IDR(pin1 varchar(20),pin4 varchar(20),pin6 varchar(20),pin7 varchar(20),pin9 varchar(20),MOL varchar(20)) returns float DETERMINISTIC begin declare output float;

Re: indexing tables using my owns functions

2007-11-13 Thread Martijn Tonies
mysql create index AA on precalc (IDR(P1,P4,P6,P7,P9,'HLA-DRB13')); But i Get the following error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''P1','P4','P6','P7','P9','HLA-DRB13'))'

indexing tables using my owns functions

2007-11-13 Thread Pau Marc Munoz Torres
Hi I've created a function that return a float value the code for it is : create function IDR(pin1 varchar(20),pin4 varchar(20),pin6 varchar(20),pin7 varchar(20),pin9 varchar(20),MOL varchar(20)) returns float DETERMINISTIC begin declare output float;

Re: indexing tables using my owns functions

2007-11-13 Thread Pau Marc Munoz Torres
, as far as i can see, from mysql 5.0 and upper it is possible create index using functions. http://www.faqs.org/docs/ppbook/r24254.htm But i keep having problems with the exemple from the link. Is there any bug in mysql 5.0.24a-log? 2007/11/13, Martijn Tonies [EMAIL PROTECTED]: mysql

Re: indexing tables using my owns functions

2007-11-13 Thread Martijn Tonies
, as far as i can see, from mysql 5.0 and upper it is possible create index using functions. http://www.faqs.org/docs/ppbook/r24254.htm But i keep having problems with the exemple from the link. Is there any bug in mysql 5.0.24a-log? The above website says: Practical PostgreSQL I cannot

declaration of constants in MySQL functions

2007-09-18 Thread spikerlion
Hello, is there a possibility to declare constants in MySQL functions? declare test_name varchar(50) DEFAULT 'test'; The variable test_name here ist changeable but it should not be. Oracle syntax: test_name CONSTANT VARCHAR2(50) := 'test'; Regards, Spiker -- Pt! Schon vom neuen GMX

Why doesn't MySQL support gzip encode/decode functions.

2007-06-12 Thread Kevin Burton
Why doesn't mysql support gzip for COMPRESS/UNCOMPRESS and only zlib For network applications zlib is a lot less compatible than gzip. For example I could send gzip'd content directly from the database within a larger gzip'd stream. Kevin -- Founder/CEO Tailrank.com Location: San

Re: Arbitrary Boolean Functions as Relational Database Structure?

2007-06-09 Thread Baron Schwartz
Hi David, David T. Ashley wrote: Hi, I'm implementing a software release database. Users may aribtrarily be members of groups (a many-to-many mapping), and each software release may contain multiple files. I'd like to allow users the maximum flexibility in deciding who may view what software

Re: Arbitrary Boolean Functions as Relational Database Structure?

2007-06-09 Thread Chris W
This seems like a simple query to me. Correct me if I am wrong but as I understand it you want to get a list of SwReleases that a user has access to. Would something like this not work SELECT s.ID, s.Name FROM SwRelease as s WHERE s.ID IN ( SELECT SwID FROM GroupSwRel-- this table is

Arbitrary Boolean Functions as Relational Database Structure?

2007-06-08 Thread David T. Ashley
Hi, I'm implementing a software release database. Users may aribtrarily be members of groups (a many-to-many mapping), and each software release may contain multiple files. I'd like to allow users the maximum flexibility in deciding who may view what software releases. The most obvious

Re: Network address functions in MySQL?

2007-05-16 Thread js
://thenoyes.com/littlenoise/?p=49 On 5/15/07, Baron Schwartz [EMAIL PROTECTED] wrote: Hello, js wrote: Hi. Today I found postgresql's neat feature, inet operators, which allows you to do inet '192.168.1/24' inet '192.168.1.5' http://www.postgresql.org/docs/current/static/functions-net.html

Network address functions in MySQL?

2007-05-15 Thread js
Hi. Today I found postgresql's neat feature, inet operators, which allows you to do inet '192.168.1/24' inet '192.168.1.5' http://www.postgresql.org/docs/current/static/functions-net.html Is there anyway to do this using MySQL? -- MySQL General Mailing List For list archives: http

Re: Network address functions in MySQL?

2007-05-15 Thread Baron Schwartz
Hello, js wrote: Hi. Today I found postgresql's neat feature, inet operators, which allows you to do inet '192.168.1/24' inet '192.168.1.5' http://www.postgresql.org/docs/current/static/functions-net.html Is there anyway to do this using MySQL? Yes. Have a look at the inet_ntoa

RE: Network address functions in MySQL?

2007-05-15 Thread Edward Kay
-Original Message- From: js [mailto:[EMAIL PROTECTED] Sent: 15 May 2007 15:31 To: MySQL List Subject: Network address functions in MySQL? Hi. Today I found postgresql's neat feature, inet operators, which allows you to do inet '192.168.1/24' inet '192.168.1.5' http

Re: Network address functions in MySQL?

2007-05-15 Thread Baron Schwartz
/current/static/functions-net.html Is there anyway to do this using MySQL? Yes. Have a look at the inet_ntoa() and inet_aton() functions. Cheers Baron -- Baron Schwartz http://www.xaprb.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http

Re: Network address functions in MySQL?

2007-05-15 Thread js
'192.168.1/24' inet '192.168.1.5' http://www.postgresql.org/docs/current/static/functions-net.html Is there anyway to do this using MySQL? Yes. Have a look at the inet_ntoa() and inet_aton() functions. Cheers Baron -- MySQL General Mailing List For list archives: http://lists.mysql.com

Re: Functions and NULL with standard install

2007-03-26 Thread Shawn Green
Hello Lucas, [EMAIL PROTECTED] wrote: I don't see how to use this here, I will have to research the |/||/| select rpad(|IFNULL(|null, ''),5,'1'); |/||/| snip The function you want to use is IFNULL() documented here:http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html

Functions and NULL with standard install

2007-03-21 Thread Lucas . CTR . Heuman
I am running a basic install of MySQL 5.0 with strict mode turned on I would like to use RPAD however at times a NULL var will be sent to the function. My goal is to have a function that will convert the NULL to a blank string to get the result of EXAMPLE3 if a NULL is returned. EXAMPLE 1

Re: Functions and NULL with standard install

2007-03-21 Thread Joshua Marsh
On 3/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am running a basic install of MySQL 5.0 with strict mode turned on I would like to use RPAD however at times a NULL var will be sent to the function. My goal is to have a function that will convert the NULL to a blank string to get the

Re: Functions and NULL with standard install

2007-03-21 Thread Francesco Riosa
select rpad(|IFNULL(|null, ''),5,'1'); |/||/| [EMAIL PROTECTED] ha scritto: I am running a basic install of MySQL 5.0 with strict mode turned on I would like to use RPAD however at times a NULL var will be sent to the function. My goal is to have a function that will convert the NULL to a

Re: Functions and NULL with standard install

2007-03-21 Thread Lucas . CTR . Heuman
I don't see how to use this here, I will have to research the |/||/| select rpad(|IFNULL(|null, ''),5,'1'); |/||/| but this below works thank you SELECT RPAD(CASE WHEN NULL IS NULL THEN '' ELSE '2' END, 5, '1'); If you are using it on an actual field, you would replace the first NULL and

Re: How to SELECT rows closest to lat/lng -- USING SPATIAL FUNCTIONS

2007-02-04 Thread M5
Thanks! That really seems to do the trick. Amazing. Now, for some stupid questions: The values 69.1 and 57.3... are you aware of some documentation or tutorial explaining these values and the math? I'd like to understand why it works. Also, I would like to figure out how to, if possible, speed

Re: How to SELECT rows closest to lat/lng -- USING SPATIAL FUNCTIONS

2007-02-03 Thread Lars Schwarz
haven't followed the complete thread so i don't know what you're after, but maybe this helps? SELECT latitude, longitude, SQRT( POW( 69.1 * ( latitude - [startlat] ) , 2 ) + POW( 69.1 * ( [startlng] - longitude ) * COS( latitude / 57.3 ) , 2 ) ) AS distance FROM foobar ORDER BY distance ASC

Re: How to SELECT rows closest to lat/lng -- USING SPATIAL FUNCTIONS

2007-02-02 Thread M5
Thanks for the reply... It returns results, but not exactly what I am hoping for--basically, I get the nearest latitudes (but not near longitude), and nearest longitude (but not near latitudes). In other words, it doesn't return the closest lat/lng pair... Also, the query takes about 8

Views with functions and performance issues

2006-09-22 Thread Christopher Brooks
Hi, I've got a view of a base table that is 100% identical to that base table except for one column, which is a projection of the base table after its MD5 hashed. The table is largish (~700,000 rows) and is growing quickly. Queries on the base table are nice and fast, but on the hashed view are

Re: Views with functions and performance issues

2006-09-22 Thread Dan Buettner
If I'm understanding right - the view contains an additional column that is an MD5 hash of some or all of the data in the base table, right? Yes, I would expect that to be very very slow. When selecting, your database engine has tro calculate 700K MD5 hashes. Slow. When selecting a subset it

RE: [others] Re: Views with functions and performance issues

2006-09-22 Thread Christopher Brooks
Hi, thanks for the comments, If I'm understanding right - the view contains an additional column that is an MD5 hash of some or all of the data in the base table, right? Close. It's got all of the data in the base table except for the colum that's being hashed - we show the hashed version

Re: RE: [others] Re: Views with functions and performance issues

2006-09-22 Thread Dan Buettner
The hit with a join on indexed columns is negligible. Relational databases live for joins - they eat them for breakfast! Seriously, as long as it's indexed in both tables, it'll be super-speedy. Dan On 9/22/06, Christopher Brooks [EMAIL PROTECTED] wrote: Hi, thanks for the comments, If I'm

Expressions, SQL Aggregate functions SELECT Performance - index usage

2006-08-09 Thread Asif Lodhi
the max key value to be inserted in the table instead of using the auto-increment (because it's rollback-unfriendly). However, I wonder if using such expressions (I not using any other functions except SQL Aggregate functions) in the select column-list would slow down the INSERTs and what

Date functions

2006-07-07 Thread Chris W
It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older than the current time? Something like this. SELECT * FROM t WHERE TimeCol (now() - 60*60*24*3) Yes I

RE: Date functions

2006-07-07 Thread Addison, Mark
From: Chris W Sent: 07 July 2006 09:23 It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older than the current time? Something like this. SELECT *

Re: Date functions

2006-07-07 Thread Dan Buettner
Try this: SELECT * FROM t where TimeCol date_sub( now(), INTERVAL x SECOND ) Dan On 7/7/06, Chris W [EMAIL PROTECTED] wrote: It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X

Re: Date functions

2006-07-07 Thread Brent Baisley
: Chris W [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, July 07, 2006 4:23 AM Subject: Date functions It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older

Re: Date functions

2006-07-07 Thread Chris W
Addison, Mark wrote: From: Chris W Sent: 07 July 2006 09:23 It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older than the current time? Something like

RE: functions in AS

2006-06-08 Thread Jay Blanchard
[snip] SET @sql=CONCAT('SELECT SUM(IF(SUBSTRING(updated,1,10)=CURDATE(), 1, 0)) AS ',     char(39),     CURDATE(),     CHAR(39),     ' FROM tablename GROUP BY group by psDealer' ); PREPARE stmt FROM @sql; [/snip] Very clever Peter! Thanks for your

functions in AS

2006-06-07 Thread Jay Blanchard
select psDealerID, sum(if(substring(updated, 1, 10) = curdate(), 1, 0)), sum(if(substring(updated, 1, 10) = date_sub(curdate(), interval 1 day), 1, 0)) from provision group by psDealerID I love crosstab queries, but one thing really eats at me. I'd like to be able to add significance to the

Re: functions in AS

2006-06-07 Thread Peter Brawley
Jay, We all know that you cannot do something like this; sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS curdate() nor can you use user variables even though they get set properly set @d1 = curdate(); sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS @d1 So, does anyone know of a

RE: functions in AS

2006-06-07 Thread Jay Blanchard
[snip] We all know that you cannot do something like this; sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS curdate() nor can you use user variables even though they get set properly set @d1 = curdate(); sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS @d1 So, does anyone know of a

Re: functions in AS

2006-06-07 Thread Peter Brawley
Jay, [snip] We all know that you cannot do something like this; sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS curdate() nor can you use user variables even though they get set properly set @d1 = curdate(); sum(if(substring(updated, 1, 10) = curdate(), 1, 0)) AS @d1 So,

Joining multiple tables with grouping functions

2006-05-26 Thread Ville Mattila
Hello all, I'm sure that this situation is one of the most wondered questions with JOIN clauses. Anyway, I couldn't find any clear information how to carry out multiple joins in one query with proper results. I have four tables: 1. Invoices 2. InvoiceContents 3. Customers 4. Payments I try to

Re: Joining multiple tables with grouping functions

2006-05-26 Thread Peter Brawley
Ville, SELECT Invoices.*, SUM(InvoiceContents.Amount * InvoiceContents.Price) AS InvoiceTotal, Customers.Name, SUM(Payments.Amount) PaidTotal, MAX(Payments.Date) LastPayment FROM Invoices LEFT JOIN InvoiceContents ON (InvoiceContents.InvoiceID = Invoices.ID) LEFT JOIN Customers ON (Customers.ID

Re: Joining multiple tables with grouping functions

2006-05-26 Thread Jay Pipes
associated with it. You will notice that I have taken the aggregates (the SUM and MAX functions) out of the main query and put them into the derived tables (the subqueries in the FROM clause). This prevents the multiplication effect you saw earlier. Also, I have used the COALESCE function

String functions FORMAT(X,D)

2006-05-23 Thread Jay
Hello MySQL Users Is there a way to change the separator in the following example, e.g. from , to '? SELECT FORMAT(12332.123456, 4); - '12,332.1235' is this the easiest way? SELECT REPLACE(FORMAT(12332.123456, 4), ,, '); - '12'332.1235' or can this be set somewhere? Thank you! Jay --

Re: Crypt Functions

2006-05-22 Thread sheeri kritzer
http://dev.mysql.com/doc/refman/4.1/en/encryption-functions.html On 5/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Guys, Can somebody enlighten me on AES_CRYPT AES_DECRYPT functions on MySQL. I noticed that you can mention DES key file in mysqld statup options. how does the AES works

Crypt Functions

2006-05-21 Thread kosalaa
Hi Guys, Can somebody enlighten me on AES_CRYPT AES_DECRYPT functions on MySQL. I noticed that you can mention DES key file in mysqld statup options. how does the AES works? is there any one who used these functions (production systems)? Thanx in Advance, Kosala

The MySQL Stored Procedures and Functions is ready ?

2006-05-05 Thread Dyego Souza Dantas Leal
The MySQL Stored Procedures and Functions is ready to use on production systems ? or support is very ammature ? I need to know because is a project desing decision ! Tnks !! PLEASE I NEED OPINIONS i'm crazy to use this ? Tnks in advance MySQL , InnoDB and Linux

Re: The MySQL Stored Procedures and Functions is ready ?

2006-05-05 Thread Martijn Tonies
The MySQL Stored Procedures and Functions is ready to use on production systems ? or support is very ammature ? I need to know because is a project desing decision ! Tnks !! PLEASE I NEED OPINIONS By the time your project is finished designing, it will be ready ;-) Martijn

Re: Cannot create functions from a workstation

2006-04-23 Thread Shawn Green
My response is mixed with your original post... --- Jim [EMAIL PROTECTED] wrote: Hi All, We are unable to create functions, views and stored procs from another machine. The error message is Access denied for user 'root'@'%' to database 'proplink'. Then the user 'root' does

Including other hash-functions

2006-03-12 Thread Lars Strojny
Hi, as you know, MD5 and SHA1 are more or less broken so I guess it is time to think about including other hash-functions in MySQL. First of all it would be sensible to include SHA256 / SHA512, because they are designed a bit different to SHA1 and though are more safe. Another issue is to include

RE: Aggregate functions in ORDER BY

2006-03-09 Thread Dave Pullin
PROTECTED] Sent: Wednesday, March 08, 2006 11:10 PM To: Dave Pullin Cc: mysql@lists.mysql.com Subject: Re: Aggregate functions in ORDER BY Many thanks for that Dave. Do you know whether it's possible for MySQL to return fully qualified column names by default? For example, I'd like

Re: Aggregate functions in ORDER BY

2006-03-09 Thread Yasir Assam
11:10 PM To: Dave Pullin Cc: mysql@lists.mysql.com Subject: Re: Aggregate functions in ORDER BY Many thanks for that Dave. Do you know whether it's possible for MySQL to return fully qualified column names by default? For example, I'd like select * from foo; to return

Re: Aggregate functions in ORDER BY

2006-03-09 Thread Yasir Assam
on the temp table and then of course dropping it. -Original Message- From: Yasir Assam [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 7:10 PM To: mysql@lists.mysql.com Subject: Aggregate functions in ORDER BY Hello, I noticed something strange in MySQL (I'm using 4.1.15). If I use

Aggregate functions in ORDER BY

2006-03-08 Thread Yasir Assam
Hello, I noticed something strange in MySQL (I'm using 4.1.15). If I use an aggregate function in the ORDER BY clause I get an error. SELECT men.man_name, COUNT(pets.pet_id) FROM men, pets WHERE men.man_id = pets.pet_man_id GROUP BY men.man_id ORDER BY COUNT(pets.pet_id) DESC; gives

RE: Aggregate functions in ORDER BY

2006-03-08 Thread Dave Pullin
: Aggregate functions in ORDER BY Hello, I noticed something strange in MySQL (I'm using 4.1.15). If I use an aggregate function in the ORDER BY clause I get an error. SELECT men.man_name, COUNT(pets.pet_id) FROM men, pets WHERE men.man_id = pets.pet_man_id GROUP BY men.man_id ORDER

Re: Aggregate functions in ORDER BY

2006-03-08 Thread Yasir Assam
by count ) as subtable Dave -Original Message- From: Yasir Assam [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 9:10 PM To: mysql@lists.mysql.com Subject: Aggregate functions in ORDER BY Hello, I noticed something strange in MySQL (I'm using 4.1.15). If I use an aggregate

RE: Aggregate functions in ORDER BY

2006-03-08 Thread Nicolas Verhaeghe
dropping it. -Original Message- From: Yasir Assam [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 7:10 PM To: mysql@lists.mysql.com Subject: Aggregate functions in ORDER BY Hello, I noticed something strange in MySQL (I'm using 4.1.15). If I use an aggregate function in the ORDER

puzzled by date functions (long)

2006-03-01 Thread Giuseppe Maxia
Yesterday I was analyzing the behavior of the query optimizer, and I stumbled into a most curious case. I created two functions returning the extremes of a date range, and I wanted to see how many times those functions were called when used in a WHERE clause So I added log tracing instructions

  1   2   3   4   >