What's the difference between POINT(X,Y) and GeomFromText("POINT(X Y)")?

There are two different binary formats related to the MySQL spatial extensions, the "well-known binary" (WKB) format from the standards, and the MySQL internal GEOMETRY data type.

Prior to MySQL 5.1.35, functions like POINT() didn't return the MySQL internal data type; they returned WKB... so prior to then, you had to do this:

INSERT INTO t1 (pt_col) VALUES (GeomFromWKB(Point(1,2)));

But now, as in your example, this works:

INSERT INTO t1 (pt_col) VALUES(Point(1,2));

To the developers' credit, when they changed Point() and similar functions to (more sanely) return GEOMETRY objects, they allowed GeomFromWKB() and similar functions to actually accept either WKB or MySQL Geometry data as input even though the functions are intended to accept WKB as input.

The fact that the 1st method works (in spite of being technically wrong) on newer servers and the 2nd method doesn't work at all prior to MySQL 5.1.35 might explain why examples were written using the approach you've seen -- to avoid the issue entirely. Otherwise... I've got nothing, here.

Concatenating and then parsing text seems intuitively slower and more error-prone than functions that accept proper variables as input, so I can't think of any reason to craft concatenated strings and use the text-based functions.

http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb-functions

http://dev.mysql.com/doc/relnotes/mysql/5.1/en/news-5-1-35.html


MySQL 8+

For posterity the only thing that matters is that

  • Point(X,Y) is a constructor for numbers with precision and does not require converting first to text making it faster. It's also guaranteed to RETURN A POINT OR FAIL. This makes it strongly typed if you want to think of it like that.
  • Well-Known text (WKT) constructors: these are always slower, as they require an addition step to parse the Well-Known text (WKT). Note in older versions these could be found without the ST_ prefix; where available, use the version with the ST_ prefix. Use the WKT-constructors only if your input is already Well-known text. If not, use the Point(x,y) constructor above.
    • ST_GeomFromText(wkt, srid) can return ANY spatial type that is supported by MySQL and can represented by WKT. This makes it loosely typed if you want to think of it like that.
    • ST_PointFromText(wkt, srid) a strongly-typed POINT-constructor from Well-known text.

Clarity

Skipping the history lesson, NEVER do GeomFromText(Point(x,y)). That's horrible, unsupported, and undocumented.