External Tables Flashcards

1
Q

What are external tables? What is the differences against regular tables?

A

External tables - data actually lies outside of the SF in a cloud. Data is not COPY INTO.
Using External tables, SF provides a way that you can build DDL (table) on top of data present in cloud s3/azure/gcp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is external tables better performant than regular tables?

A

No - As data is outside of SF, it is not better performance compared to regular tables. However you can build materialized views on top of external tables for performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you write to external tables? Can you use external tables in joins etc.

A

External tables are read only. But you can add or remove columns though.
Yes external tables can be used in joins/filters etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the default columns in external tables?

A

VALUE : Variant data type column which represents 1 row in the external file
METADATA$FILENAME: it provides file name and path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is virtual columns in external tables?

A

Using the VALUE column, you can parse the row and create multiple virtual columns in external tbales.

select

value: c1::int as ID,
value: c2::varchar as name ,
value: c3::int as dept from sample_ext;

create or replace external table sample_ext 
(ID INT as  (value:c1::int), 
Name varchar(20) as ( value:c2::varchar), 
dept int as (value:c3::int))
with location = @mys3stage
file_format = mys3csv;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is partitioning external tables?

A

It is arranging and organizing your external files using logical paths in s3. Ex: date/time/country etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you refresh metadata of external tables?

A

Using SQS service in s3. And these event notifications charge extra credits in s3.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

By default does it error out when there is an error in scanning one of the underlying files?

A

No, by default it will skip and go to next file. It will end up in partial scanning.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How long does the results persist in external tables?

A

Similar to regular one, results persist for 24 hours unless some DML operations or auto ingest from SQS happens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What tables/views in information schema provide information on external tables?

A

External_tables view
External_tables_files (table)
and couple others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What SF object type is used to connect between SF and AWS?

A

Integration object which contains secret keys, credentials, URL so we need not mention them explicitly in our code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is search optimization services? (SOS)

A

For point look up queries- for specific filters and those columns are also non clustered.

It is a service with which speed of the query can be increased 25 times.
Improves the performance of point look up queries.

This is like alternative to speed up queries like larger warehouses/materialized views/clustering.

For queries that use non clustered columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the benefits of search optimization services? (SOS)?

A
  1. Cost effective ( no need to increase the WH size just for few queries)
  2. Fast running queries for users
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you add search optimization services? (SOS) to existing table?

A

ALTER TABLE add search optimization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What metadata columns you will see when SOS is enabled?

A

When doing SHOW TABLES - will see 3 additional columns

search optimization (flag)
search_optimization_progress (it takes some time to do SOS - so it says whether the set up is complete or not)
search_optimization_bytes (size)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does the query profile look when SOS is enabled?

A

you will see a box for SOS and can see pruning where partitions scanned is much lesser than partitions total

17
Q

Does SOS service impact storage and computing costs?

A

Yes.

storage - SF creates service access path (SAP) data structures which require space and these are used when queries run on SOS tables. Usually 25% of original table size.

compute - Adding SOS itself takes some computing needed and when table changes a lot, computing is needed for maintenance.

18
Q

Can you remove SOS once set up?

A

Yes using alter table command

ALTER TABLE DROP SEARCH OPTIMIZATION

19
Q

What kind of functions uses SOS and which one does not?

A

ex: all colum_name=values should use SOS
but if you are casting cast(column to number)=2 - this will not use SOS.

But if you put it along with any other valid SOS column then it is ok.

select id, c1, c2, c3
    from test_table
    where c1 = 1
       and
          c3 = to_date('2004-03-09')
    order by id;
20
Q

Does delete/update/merge use SOS?

A

yes they do

ex: delete from table where id=5