Tag Info

New answers tagged

2

Given that: Table1 is all VARCHAR(50) NULL and Table2 (a separate table) is proper datatypes, also NULLable Sample data in Table1 based on DATALENGTH appears to take up more space than in Table2, regardless of any optimization of BIT fields We have no additional information regarding: how many rows/fields have NULLs if the DATALENGTH was taken from a ...


3

Interesting question, I created both table1 and table2 in SQL Server 2014 and populated 2000 rows of the same data you have provided. When checking the amount of space consumed by each table, here is what I got: table1 (varchar) - 392K table2 (bit) - 168K However when I alter all the column types in table1 to match table2, the space used grew to 540K. ...


4

Your query would fail, because the standard name of an integer is "integer", not "int". You can avoid this kind of error by comparing the internal regtype OID instead of a text representation. Many basic data types have several alias names, they all resolve to the same internal registered type. That aside, you can largely simplify and improve: SELECT ...


2

The simplest solution without PostGIS would be to store lat/long as two number columns. numeric for exact precision. double precision or even just real if you don't need the precision. I see no reason why the data type point shouldn't work as well. Per documentation: Points are the fundamental two-dimensional building block for geometric types. Values ...



Top 50 recent answers are included