Searching nearest object

Hi,
I have lat long of a point and i need to search nearest/ 3 nearest object (we have lat long of the object too) to that point (we created omnisci_geo as we found this distance function in documents). i used below query
Every objectID is unique and is present one time only in the database.

Please help how can we achieve this objective as when we try to fetch distnace between 2 lat and long there is totally another value

select objectid, ST_Distance(omnisci_geo, ST_GeomFromText(‘POINT(72.52297921796128 23.03044114302746)’ )) from objects ORDER BY id ASC LIMIT 6;

id. EXPR$
672776 1.0515747765555439
672776 1.0515747765555439
672776 1.0515747765555439
672776 1.0515747765555439
672776 1.0515747765555439
985101 1.1525510715349694

1 record details
OBJECTID|Long_Object|Lat_Object|BUFF_DIST|ORIG_FID|Shape_Leng|Shape_Area|omnisci_geo
985101|71.7681900003|22.1594199997|0.5|20409|3.14159265359|0.7853981634|MULTIPOLYGON (((71.7681898510867 22.159424508996,71.7681890128964 22.1594243832675,71.768188174706 22.1594241737199,71.7681874203348 22.1594238384438,71.7681867497825 22.1594233774391,71.7681861630493 22.1594227907059,71.7681857439541 22.1594221620632,71.768185408678 22.1594214496014,71.7681851572209 22.1594206533206,71.7681851572209 22.1594198989493,71.7681852410399 22.1594191026685,71.768185408678 22.1594183482972,71.7681858277732 22.1594176358354,71.7681863306873 22.1594170071927,71.7681869174206 22.159416462369,71.7681875879728 22.1594160432738,71.7681884261631 22.1594157079977,71.7681891805344 22.1594155403596,71.7681901025438 22.1594154565406,71.7681909407341 22.1594155403596,71.7681916951054 22.1594157918167,71.7681924494767 22.1594161270929,71.7681931200289 22.1594165880975,71.7681937067621 22.1594171329212,71.7681942096763 22.1594178034735,71.7681945449525 22.1594185159353,71.7681947125905 22.1594192703066,71.7681947964095 22.1594200665874,71.7681947125905 22.1594208628682,71.7681944611334 22.1594216172394,71.7681941258573 22.1594223297012,71.7681936229431 22.159422958344,71.7681929523908 22.1594235031677,71.7681922818386 22.1594239222628,71.7681915274673 22.1594242575389,71.768190689277 22.159424425177,71.7681898510867 22.159424508996)))
Screenshot 2021-12-12 at 8.41.12 PM

Hi @Vidur_Mittal,

I tried your query against a table with around a table with 400000 unique multi-polygons without any duplication.

omnisql> select SEZ2011, ST_Distance(omnisci_geo, ST_GeomFromText('POINT(72.52297921796128 23.03044114302746)' )) from istat_census_sections order by 2 limit 10;
SEZ2011|EXPR$1
750570000053|56.63825768677142
750570000065|56.63862095078738
750570000048|56.64977954173847
750570000060|56.65005042040301
750570000052|56.65547827486034
750570000050|56.65758262497934
750720000010|56.66176530600992
750720000009|56.66238542157077
750570000017|56.66338323601052
750720000012|56.66545711102495
10 rows returned.
Execution time: 942 ms, Total time: 943 ms

the distance returned with this query defaults to degrees because the srid is 4326; changing to 900213 the distance is returned in meters (change the point to the center of Rome, because of the dataset)

omnisql> select SEZ2011, ST_Distance(st_transform(omnisci_geo,900913), st_transform(ST_SetSRID(ST_Point(12.4964,41.928), 4326),900913)),cod_reg from istat_census_sections order by 2 limit 10;
SEZ2011|EXPR$1|cod_reg
580912020053|0|12
580912020093|225.5011391987121|12
580912020078|253.3402214487469|12
580912020089|284.446771476448|12
580912020099|359.062562310744|12
580912020103|377.7605361871876|12
580912020092|395.1893239782749|12
580912020111|398.8310757149861|12
580912020108|422.9690310244776|12
580912020112|439.7241301049751|12
10 rows returned.
Execution time: 1917 ms, Total time: 1918 ms

Regards,
Candido.

Appreciate your quick response this helps