408 Commits

Author SHA1 Message Date
Matvey Arye
851a3d2c23 Merged in mat/groupby-mergeappend (pull request #137)
Optimize queries with date_trunc in ORDER BY and a LIMIT.

Approved-by: Erik Nordström <erik.nordstrom@gmail.com>
Approved-by: ci-vast
2017-04-05 20:54:28 +00:00
Matvey Arye
83346079d7 Make optimization of date_trunc more general.
Handle case where there is an additional constraint on time.
This makes the pathkeys for the IndexPath incompatible with
upper level ordering. Since we know the appropriate transform
for those pathkeys already, apply it to those paths too.
2017-04-05 16:35:14 -04:00
Matvey Arye
ea0c97d590 Optimize queries with date_trunc in ORDER BY and a LIMIT.
Common time-series rollups are of the form SELECT date_trunc(const,
time) as t, aggregates... GROUP BY t ORDER BY t DESC LIMIT const2.
Previously, Postgres would not optimize such queries because it
could not match date_trunc(const, time) to any indexes on time, since
it has no way to know that a sort on time is always a valid sort on
date_trunc(const, time).

This commit implements this optimization for date_trunc but it could
apply to a wider range of functions, to be implemented later.
2017-04-05 16:35:14 -04:00
Rob Kiefer
5723f332af Change Docker Hub organization to 'timescale 2017-04-03 17:17:55 -04:00
Matvey Arye
6a2ee3320b Merged in fix-whole-cache-invalidate (pull request #141)
Fix logic for when entire cache is invalidated

Approved-by: ci-vast
Approved-by: RobAtticus NA <rob.kiefer@gmail.com>
Approved-by: Olof Rensfelt <olof@iobeam.com>
Approved-by: Erik Nordström <erik.nordstrom@gmail.com>
2017-04-03 16:01:04 +00:00
Matvey Arye
e87bc774d7 Fix logic for when entire cache is invalidated
Sometimes postgres wants to invalidate the entire cache. In this case it
send a cache invalidation message with relid == InvalidOid. This should
invalidate all the caches. Previously, it did not effect the cache of
the extension state. This fixes that problem and creates one cache reset
code path for both extension dropping and whole-cache reset, cleaning
up some of the logic in the process.
2017-03-31 17:31:34 -04:00
Rob Kiefer
d1dd911a62 Fix alignment issue in README 2017-03-29 14:40:50 -04:00
Rob Kiefer
537d8d227c Update README build status image 2017-03-27 22:35:45 -04:00
Solar Olugebefola
003a71adca Merged in readme-prereq (pull request #140) 2017-03-27 19:43:47 +00:00
Solar Olugebefola
44490c5928 Add psql prerequisite 2017-03-27 15:32:42 -04:00
Rob Kiefer
cbec8399fb Update Homebrew tap name 2017-03-27 14:15:48 -04:00
Rob Kiefer
b290c18b1b Make minor consistency tweaks to README 2017-03-24 16:47:36 -04:00
RobAtticus NA
41a9d53a5a Merged in install-options (pull request #139)
Add new methods of installation to README

Approved-by: ci-vast
Approved-by: Solar Olugebefola <solar@iobeam.com>
2017-03-24 20:42:23 +00:00
Rob Kiefer
065d9ed16f Add new methods of installation to README 2017-03-24 16:13:15 -04:00
Rob Kiefer
e031dfc795 Release 0.0.5-beta 0.0.5-beta 2017-03-24 12:48:58 -04:00
Matvey Arye
d13f1e86db Merged in mat/fix-simultaneous-chunk-creation-bug (pull request #138)
Fix bug with simultaneous chunk creation.

Approved-by: Olof Rensfelt <olof@iobeam.com>
Approved-by: RobAtticus NA <rob.kiefer@gmail.com>
Approved-by: ci-vast
2017-03-24 16:31:11 +00:00
Matvey Arye
f908671e04 Fix bug with simultaneous chunk creation.
Previously chunks could be simultaneously created for the same
partition_id and a start_time and end_time of both NULL. This
prevents such bugs bug adding additional unique constraints and
locking the partition for chunk creation (as originally intended).
2017-03-24 12:12:07 -04:00
Erik Nordström
ee06ac5523 Merged in enordstr/backend-database/enordstr/use-cache-memory-context-on-updates (pull request #135)
Use a cache's own memory context on cache updates

Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: ci-vast
2017-03-24 07:32:26 +00:00
Erik Nordström
5c2bef47f1 Use a cache's own memory context on cache updates
In case new allocations are made during a cache entry update, we
should use the cache's internal memory context to ensure that new data
is allocated and freed in a way consistent with the rest of the cache.
2017-03-24 08:16:36 +01:00
Erik Nordström
9c8e40fbcf Merged in enordstr/backend-database/enordstr/cleanup-tests (pull request #136)
Cleanup tests and make errors less verbose

Approved-by: RobAtticus NA <rob.kiefer@gmail.com>
Approved-by: ci-vast
2017-03-24 07:14:14 +00:00
Erik Nordström
9023de61db Cleanup tests and make errors less verbose
Previously, each test set their own (although mostly the same)
configuration for log output and error verbosity. This is now set
globally in the test runner so that tests only need to set these
configuration parameters if they need to override the defaults.  The
log verbosity is also reduced so that errors aren't generated with the
line number of the source file that output the error. Line numbers in
the output can break tests when upgrading to a new PostgreSQL version
that outputs a different line number.
2017-03-23 22:56:03 +01:00
Rob Kiefer
3fd8bdbd71 Update Docker to use PostgreSQL 9.6.2 2017-03-22 19:38:39 -04:00
Rob Kiefer
5f5a49dffb Release 0.0.4-beta 0.0.4-beta 2017-03-22 18:57:11 -04:00
Rob Kiefer
4c050ad815 Update sample queries' results for datasets 2017-03-22 18:56:00 -04:00
Erik Nordström
2fb71768a3 Merged in enordstr/backend-database/enordstr/fix-drop-extension (pull request #131)
Fix DROP EXTENSION

Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: ci-vast
2017-03-22 18:49:46 +00:00
Erik Nordström
c60b08e83a Fix DROP EXTENSION
DROP EXTENSION didn't properly reset caches and other saved state
causing various errors related to bad state when the extension was
dropped and/or recreated later.

This patch adds functionality to track the state of the extension and
also signals DROP EXTENSION to other backends that might be running,
allowing them to reset their internal extension state.
2017-03-22 19:43:40 +01:00
RobAtticus NA
643cba1dd2 Merged in check-postgres (pull request #134)
Update Makefile to check for proper PostgreSQL version

Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: ci-vast
2017-03-22 17:04:47 +00:00
Rob Kiefer
c45e1e1f2c Update Makefile to check for proper PostgreSQL version 2017-03-22 12:11:23 -04:00
enordstr NA
e4928c0835 Merged in enordstr/backend-database/enordstr/cleanup-insert-state-on-error (pull request #133)
Cleanup insert state on error

Approved-by: RobAtticus NA <rob.kiefer@gmail.com>
Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: ci-vast
2017-03-22 14:32:37 +00:00
Erik Nordström
473d743927 Cleanup insert state on error
If an error is generated in any of the insert triggers, the insert
state kept during a batch insert might be left in an undefined state,
breaking the next insert. This patch makes sure errors are captured in
the insert triggers so that the state can be cleaned up.
2017-03-22 15:20:45 +01:00
RobAtticus NA
cdfa8bd946 Merged in default-port-fix (pull request #132)
Rename setup_db() and fix port for local connections

Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: Olof Rensfelt <olof@iobeam.com>
Approved-by: ci-vast
2017-03-22 14:11:26 +00:00
Rob Kiefer
cb90eef350 Rename setup_db() and fix port for local connections
If a user attempts to setup a database while not connecting using
the network, port is NULL and thus fails constraint checks. Instead,
we now use the default Postgres port of 5432 when this happens.

Also, setup_db() is renamed to setup_timescaledb() for clarity in
the presence of other extensions.
2017-03-22 09:26:03 -04:00
enordstr NA
b2682a7b57 Merged in enordstr/backend-database/enordstr/cache-stats-and-cleanup (pull request #130)
Add cache statistics and do minor cleanup

Approved-by: Matvey Arye <cevian@gmail.com>
Approved-by: ci-vast
Approved-by: Olof Rensfelt <olof@iobeam.com>
2017-03-22 09:42:17 +00:00
Erik Nordström
89692c9761 Add cache statistics and do minor cleanup
Track statistics for cache hits and misses in the cache module.
Currently not exposed to SQL, but might be useful for internal
debugging.
2017-03-22 09:57:44 +01:00
Matvey Arye
9ef0e6c900 Merged in add-sql-query-test (pull request #129)
Add query tests for ORDER BY time DESC queries LIMIT queries

Approved-by: ci-vast
Approved-by: enordstr NA <erik.nordstrom@gmail.com>
Approved-by: Olof Rensfelt <olof@iobeam.com>
2017-03-21 15:37:36 +00:00
Matvey Arye
e0d63e915c Add query tests for ORDER BY time DESC queries LIMIT queries
These tests show that non-aggregated queries that have an ORDER BY time
DESC LIMIT x structure perform well. Postgres processes such queries by
using a time DESC index and then performs a MergeAppend. Some further
optimization to avoid touching unnecessary tables due to constraints
can be added but they are not a priority. Much worse is that these
optimizations do not work when grouping by time (either through
integer division or using date_trunc).

In order to use the non-aggregated query optimizations we had
to create an index with time as the leading field and no
WHERE clause on the index.
2017-03-21 11:36:47 -04:00
Solar Olugebefola
b32c3789cf Merged in device-to-location (pull request #128) 2017-03-21 15:29:37 +00:00
Solar Olugebefola
03e4618bf0 Change 'device_id' to 'location_id' 2017-03-21 11:28:04 -04:00
Rob Kiefer
f66ae0a8a7 Add build status image to top of README 2017-03-16 18:39:31 -04:00
Rob Kiefer
5e01e150a1 Add travis build file 2017-03-16 18:27:28 -04:00
Rob Kiefer
20d1cc46de Clarify limitation for user triggers on hypertables 2017-03-16 16:47:21 -04:00
enordstr NA
1b92de0f47 Merged in enordstr/backend-database/enordstr/move-typedefs-script (pull request #125)
Move generate_typedef.sh to scripts directory

Approved-by: Olof Rensfelt
Approved-by: ci-vast
2017-03-16 09:58:47 +00:00
Erik Nordström
b4c9055184 Move generate_typedef.sh to scripts directory 2017-03-16 10:48:21 +01:00
enordstr NA
267a38238b Merged in enordstr/backend-database/enordstr/add-depfiles-to-gitignore (pull request #126)
Add dependency files to .gitignore

Approved-by: Olof Rensfelt
Approved-by: ci-vast
2017-03-16 09:47:46 +00:00
Erik Nordström
f6adb5da65 Add dependency files to .gitignore 2017-03-16 10:17:16 +01:00
enordstr NA
b2b33875d0 Merged in enordstr/backend-database/enordstr/header-dependencies (pull request #121)
Generate object dependencies to force 'make' to recompile on changes to headers

Approved-by: Matvey Arye
Approved-by: Olof Rensfelt
Approved-by: ci-vast
2017-03-16 08:53:41 +00:00
Erik Nordström
e5b489b1ba Generate object dependencies to force 'make' to recompile on changes to headers
Previously, running 'make' did not recompile source files when changes
were made to header files. Now the compiler generates dependency files
that will pick up changes to header files and recompile any source
files that include the updated header.

Also, remove insert.h, which is not needed.
2017-03-16 09:45:36 +01:00
RobAtticus NA
b4d6263709 Merged in docs-link (pull request #124)
Add link to docs site in README

Approved-by: ci-vast
Approved-by: Ajay Kulkarni
2017-03-15 21:46:31 +00:00
Rob Kiefer
cd05cba75c Add link to docs site in README 2017-03-15 15:42:25 -04:00
Ajay Kulkarni
25947958f6 Merged in readme-edits-ajay (pull request #123)
Fix bullets
2017-03-15 17:14:31 +00:00