database-indexes

Cassandra 1.1 composite keys, columns, and filtering in CQL 3

岁酱吖の 提交于 2019-12-02 05:07:58
I wish to have a table something as follows: CREATE TABLE ProductFamilies ( ID varchar, PriceLow int, PriceHigh int, MassLow int, MassHigh int, MnfGeo int, MnfID bigint, Data varchar, PRIMARY KEY (ID) ); There are 13 fields in total. Most of these represent buckets. Data is a JSON of product family IDs, which are then used in a subsequent query. Given how Cassandra works, the column names under the hood will be the values. I wish to filter these. I wish to run queries as follows: SELECT Data FROM MyApp.ProductFamilies WHERE ID IN (?, ?, ?) AND PriceLow >= ? AND PriceHigh <= ? AND MassLow >= ?

Do I need to define datastore-indexes in every microservice(module) which uses it or just in root application?

眉间皱痕 提交于 2019-12-02 03:13:53
I work on an application with several microservices (modules). I defined datastore indexes in root application (which is containing just only those cfg files like datastore-indexes.xml and queue.xml etc). I see those indexes "serving" in console. [edit] so my fault i broken query earlier so question changes little. What is best strategy with mentioned cfg files in multi-module appengine app? The datastore index configuration is one of the several app-level configurations, shared by all services/modules in the app and which can be deployed independently from the services themselves. In fact it

SQL Server - INSERT failed because of 'ARITHABORT'

ⅰ亾dé卋堺 提交于 2019-11-30 13:27:35
I use NHibernate and SQL Server 2005 and I have an index on a computed column in one of my tables. My problem is that when I insert a record to that table I get the following error: INSERT failed because the following SET options have incorrect settings: 'ARITHABORT' I use SET ARITHABORT ON; before my inserts but still have this error. For inserts on tables with computed columns, you need these set options: The NUMERIC_ROUNDABORT option must be set to OFF, and the following options must be set to ON: ANSI_NULLS ANSI_PADDING ANSI_WARNINGS ARITHABORT CONCAT_NULL_YIELDS_NULL QUOTED_IDENTIFIER Try

PostgreSQL: Can you create an index in the CREATE TABLE definition?

陌路散爱 提交于 2019-11-30 11:15:54
问题 I want to add indexes to some of the columns in a table on creation. Is there are way to add them to the CREATE TABLE definition or do I have to add them afterward with another query? CREATE INDEX reply_user_id ON reply USING btree (user_id); 回答1: There doesn't seem to be any way of specifying an index in the CREATE TABLE syntax. PostgreSQL does however create an index for unique constraints and primary keys by default, as described in this note: PostgreSQL automatically creates an index for

Creating Indexes on DB with Hibernate @Index Annotation

a 夏天 提交于 2019-11-30 08:14:32
I have annotation-driven hibernate capabilies on my project. Now I want to create an index over a column. My current column definition is @NotNull @Column(name = "hash") private String hash; and I add @Index annotation here. @NotNull @Column(name = "hash") @Index(name="hashIndex") private String hash; and then DROP TABLE and restart Tomcat server. After the server is instantiated, the table is created but I can't see new index on following query. SHOW INDEX FROM tableName It is expected to construct table with new index. I am using InnoDB with MySQL. Interestingly, in my Hibernate

Does rename_column take care of indexes?

血红的双手。 提交于 2019-11-30 01:08:59
Say, we have something like this: add_column :users, :single, :boolean add_index :users, :single and then later we do rename_column :users, :single, :married Will ActiveRecord and/or the database handle the renaming of the index as well or do I have to manually drop the index and add it again? mu is too short For PostgreSQL, rename_column is implemented as a simple ALTER TABLE ... RENAME COLUMN ... and that does preserve the indexes. The MySQL versions (both of them) do an ALTER TABLE ... CHANGE ... and that also preserves the indexes. The SQLite version appears to copy the entire table (with

SQL Server - INSERT failed because of 'ARITHABORT'

只愿长相守 提交于 2019-11-29 18:32:25
问题 I use NHibernate and SQL Server 2005 and I have an index on a computed column in one of my tables. My problem is that when I insert a record to that table I get the following error: INSERT failed because the following SET options have incorrect settings: 'ARITHABORT' I use SET ARITHABORT ON; before my inserts but still have this error. 回答1: For inserts on tables with computed columns, you need these set options: The NUMERIC_ROUNDABORT option must be set to OFF, and the following options must

Deferrable, case-insensitive unique constraint

谁都会走 提交于 2019-11-29 03:35:21
Is it possible in PostgreSQL to create a deferrable unique constraint on a character column, but case-insensitive? Let's assume the following basic table: CREATE TABLE sample_table ( my_column VARCHAR(100) ); If deferrable constraint is not needed, it is as simple as creating unique index with function, e.g.: CREATE UNIQUE INDEX my_unique_index ON sample_table(UPPER(my_column)); Deferred constraint check requires creating the constraint explicitly, e.g.: ALTER TABLE sample_table ADD CONSTRAINT my_unique_constraint UNIQUE(my_column) DEFERRABLE INITIALLY IMMEDIATE; And unfortunately it is not

Does rename_column take care of indexes?

早过忘川 提交于 2019-11-28 21:52:25
问题 Say, we have something like this: add_column :users, :single, :boolean add_index :users, :single and then later we do rename_column :users, :single, :married Will ActiveRecord and/or the database handle the renaming of the index as well or do I have to manually drop the index and add it again? 回答1: For PostgreSQL, rename_column is implemented as a simple ALTER TABLE ... RENAME COLUMN ... and that does preserve the indexes. The MySQL versions (both of them) do an ALTER TABLE ... CHANGE ... and

How do I know when to index a column, and with what?

我们两清 提交于 2019-11-28 20:07:19
问题 In docs for various ORMs they always provide a way to create indexes, etc. They always mention to be sure to create the appropriate indexes for efficiency, as if that is inherent knowledge to a non-hand-written-SQLer who needs to use an ORM. My understanding of indexes (outside of PK) is basically: If you plan to do LIKE queries (ie, search) based on the contents of a column, you should use a full text index for that column. What else should I know regarding indexes (mostly pertaining to