Skip to content

Instantly share code, notes, and snippets.

@mage2k
Created October 22, 2008 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mage2k/d0dbbf29606822b8ceb9 to your computer and use it in GitHub Desktop.
Save mage2k/d0dbbf29606822b8ceb9 to your computer and use it in GitHub Desktop.
cotest=# show enable_seqscan;
enable_seqscan
----------------
off
(1 row)
Time: 0.326 ms
cotest=# SELECT * FROM test WHERE coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540';
id | coordinates | created_at | updated_at
----+----------------------------------------------------+---------------------+----------------------------
1 | 0101000020E6100000DE205A2BDA5856C0685C381092894540 | 2008-02-02 00:00:00 | 2008-10-21 21:40:17.071026
(1 row)
cotest=# UPDATE test SET created_at = '2/1/2008' WHERE id = 1;
UPDATE 1
Time: 1.977 ms
cotest=# SELECT * FROM test WHERE coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540';
id | coordinates | created_at | updated_at
----+----------------------------------------------------+---------------------+----------------------------
1 | 0101000020E6100000DE205A2BDA5856C0685C381092894540 | 2008-02-01 00:00:00 | 2008-10-21 21:40:17.071026
(1 row)
Time: 1.013 ms
cotest=# SELECT * FROM test WHERE coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540';
id | coordinates | created_at | updated_at
----+----------------------------------------------------+---------------------+----------------------------
1 | 0101000020E6100000DE205A2BDA5856C0685C381092894540 | 2008-02-01 00:00:00 | 2008-10-21 21:40:17.071026
(1 row)
cotest=# explain analyze SELECT * FROM test WHERE coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540';
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Index Scan using test_coordinates_ix on test (cost=0.00..8.27 rows=1 width=120) (actual time=0.142..0.144 rows=1 loops=1)
Index Cond: (coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540'::geometry)
Filter: (coordinates && '0101000020E6100000DE205A2BDA5856C0685C381092894540'::geometry)
Total runtime: 0.227 ms
(4 rows)
Time: 0.902 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment