Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support supplying raw integers in DateTime columns to avoid costly ti… #42

Merged
merged 1 commit into from
Jun 29, 2018
Merged

Support supplying raw integers in DateTime columns to avoid costly ti… #42

merged 1 commit into from
Jun 29, 2018

Conversation

wawaka
Copy link
Contributor

@wawaka wawaka commented Jun 28, 2018

Ability to use integer for datetime columns allows to dramatically improve performance of INSERT operations with a lots of DateTime values (about 4x times)

@coveralls
Copy link

coveralls commented Jun 28, 2018

Coverage Status

Coverage increased (+0.004%) to 95.566% when pulling 46a29a1 on wawaka:datetime_support_int into 5928ee3 on mymarilyn:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 96.211% when pulling 9a5ca36 on wawaka:datetime_support_int into 5928ee3 on mymarilyn:master.

@xzkostyan
Copy link
Member

Hi.

Great. There is overhead on datetime to int conversion. Does clickhouse-client allow raw integer insert into DatetTme field? If yes, this is really useful feature.

What about Date field? Integer also can be passed to it.

Tests are required for any new features. There are lots of examples in tests package.

@wawaka
Copy link
Contributor Author

wawaka commented Jun 28, 2018

Yes, clickhouse-client supports parsing DateTime values from integers timestamps.

For Date field - I believe it's much less common to pass Date value as an integer.
And it does not have such performance penalty to convert date to number of days as opposed to datetime and it's manipulations with timezones.

for ts in [0, 1, 1500000000, 2**32-1]:
with self.create_table('a DateTime'):
self.client.execute(
'INSERT INTO test (a) VALUES', [(ts, )]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, but let's insert whole values in one insert: 'INSERT INTO test (a) VALUES', [(0, ), (1, ), (1500000000, ), (2**32-1, )]. It will be a little more readable.

@xzkostyan xzkostyan merged commit f378e8d into mymarilyn:master Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants