Show / Hide Table of Contents

# Class SqlFieldsQuery

SQL fields query.

##### Inheritance

System.Object
SqlFieldsQuery

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Apache.Ignite.Core.Cache.Query

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public class SqlFieldsQuery : IQueryBaseInternal

### Constructors

#### SqlFieldsQuery(String, Boolean, Object[])

Constructor,

##### Declaration

    public SqlFieldsQuery(string sql, bool loc, params object[] args)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | sql | SQL.
System.Boolean | loc | Whether query should be executed locally.
System.Object[] | args | Arguments.

#### SqlFieldsQuery(String, Object[])

Constructor.

##### Declaration

    public SqlFieldsQuery(string sql, params object[] args)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | sql | SQL.
System.Object[] | args | Arguments.

### Fields

#### DefaultPageSize

Default page size.

##### Declaration

    public const int DefaultPageSize = 1024

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultUpdateBatchSize

Default value for UpdateBatchSize.

##### Declaration

    public const int DefaultUpdateBatchSize = 1

##### Field Value

Type | Description
--- | ---
System.Int32 |

### Properties

#### Arguments

Arguments.

##### Declaration

    public object[] Arguments { get; set; }

##### Property Value

Type | Description
--- | ---
System.Object[] |

#### Colocated

Gets or sets a value indicating whether this query operates on colocated data.

Whenever Ignite executes a distributed query, it sends sub-queries to individual cluster members. If you know in advance that the elements of your query selection are colocated together on the same node and you group by colocated key (primary or affinity key), then Ignite can make significant performance and network optimizations by grouping data on remote nodes.

##### Declaration

    public bool Colocated { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### EnableDistributedJoins

Gets or sets a value indicating whether distributed joins should be enabled for this query.

When disabled, join results will only contain colocated data (joins work locally). When enabled, joins work as expected, no matter how the data is distributed.

##### Declaration

    public bool EnableDistributedJoins { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if enable distributed joins should be enabled; otherwise, `false`.

#### EnforceJoinOrder

Gets or sets a value indicating whether join order of tables should be enforced.

When true, query optimizer will not reorder tables in join.

It is not recommended to enable this property until you are sure that your indexes and the query itself are correct and tuned as much as possible but query optimizer still produces wrong join order.

##### Declaration

    public bool EnforceJoinOrder { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if join order should be enforced; otherwise, `false`.

#### Lazy

Gets or sets a value indicating whether this SqlFieldsQuery is lazy.

By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and medium result sets this provides optimal performance and minimize duration of internal database locks, thus increasing concurrency.

If result set is too big to fit in available memory this could lead to excessive GC pauses and even OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory consumption at the cost of moderate performance hit.

##### Declaration

    public bool Lazy { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### Local

Local flag. When set query will be executed only on local node, so only local entries will be returned as query result.

Defaults to `false`.

##### Declaration

    public bool Local { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### PageSize

Optional page size.

Defaults to DefaultPageSize.

##### Declaration

    public int PageSize { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

#### Partitions

Gets or sets partitions for the query.

The query will be executed only on nodes which are primary for specified partitions.

##### Declaration

    public int[] Partitions { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32[] |

#### ReplicatedOnly

Gets or sets a value indicating whether this query contains only replicated tables. This is a hint for potentially more effective execution.

##### Declaration

    [Obsolete("No longer used as of Apache Ignite 2.8.")]
    public bool ReplicatedOnly { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### Schema

Gets or sets the default schema name for the query.

If not set, current cache name is used, which means you can omit schema name for tables within the current cache.

##### Declaration

    public string Schema { get; set; }

##### Property Value

Type | Description
--- | ---
System.String |

#### Sql

SQL.

##### Declaration

    public string Sql { get; set; }

##### Property Value

Type | Description
--- | ---
System.String |

#### Timeout

Gets or sets the query timeout. Query will be automatically cancelled if the execution timeout is exceeded. Default is System.TimeSpan.Zero, which means no timeout.

##### Declaration

    public TimeSpan Timeout { get; set; }

##### Property Value

Type | Description
--- | ---
System.TimeSpan |

#### UpdateBatchSize

Gets or sets batch size for update queries.

Default is 1 (DefaultUpdateBatchSize.

##### Declaration

    public int UpdateBatchSize { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

### Methods

#### ToString()

Returns a System.String that represents this instance.

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String | A System.String that represents this instance.

##### Overrides

System.Object.ToString()